SlideShare uma empresa Scribd logo
1 de 54
CSS Tables
Table Borders
• To specify table borders in CSS, use the border
property.
• Example 
• Notice that the table in the example above
has double borders. This is because both the
table and the <th> and <td> elements have
separate borders.
Collapse Table Borders
• The border-collapse property sets whether
the table borders should be collapsed into a
single border:
• Example  -----
• If you only want a border around the table,
only specify the border property for <table>
• Example  -----
Table Width and Height
• Width and height of a table are defined by the
width and height properties.
• Example ::::
Horizontal Alignment
• The text-align property sets the horizontal
alignment (like left, right, or center) of the
content in <th> or <td>.
• By default, the content of <th> elements are
center-aligned and the content of <td>
elements are left-aligned.
• Example:: 
Vertical Alignment
• The vertical-align property sets the vertical
alignment (like top, bottom, or middle) of the
content in <th> or <td>.
• By default, the vertical alignment of the
content in a table is middle (for both <th> and
<td> elements)
• Ex::::
Table Padding
• To control the space between the border and
the content in a table, use the padding
property on <td> and <th> elements:
• Example 
Horizontal Dividers
• Add the border-bottom property to <th> and
<td> for horizontal dividers:
• Example
Hoverable Table
• Use the :hover selector on <tr> to highlight
table rows on mouse over:
• Ex 
Striped Tables
• For zebra-striped tables, use the nth-child()
selector and add a background-color to all
even (or odd) table rows:
• Ex::
Table Color
• This example specifies the background color
and text color of <th> elements:
• -
Responsive Table
• A responsive table will display a horizontal
scroll bar if the screen is too small to display
the full content:
• Ex::
CSS Layout - float and clear
The float Property
• In its simplest use, the float property can be
used to wrap text around images.
• The following example specifies that an image
should float to the right in a text:
The clear Property
• The clear property is used to control the
behavior of floating elements.
• Elements after a floating element will flow
around it. To avoid this, use the clear property.
• The clear property specifies on which sides of
an element floating elements are not allowed
to float:
Web Layout Example
• It is common to do entire web layouts using
the float property:
• Ex: 
CSS Layout - inline-block
The inline-block Value
• It has been possible for a long time to create a
grid of boxes that fills the browser width and
wraps nicely (when the browser is resized), by
using the float property.
• However, the inline-block value of the display
property makes this even easier.
• inline-block elements are like inline elements
but they can have a width and a height.
Examples
• The old way - using float (notice that we also
need to specify a clear property for the
element after the floating boxes):
• The same effect can be achieved by using the
inline-block value of the display property
(notice that no clear property is needed):
CSS Layout - The display Property
• The display property is the most important CSS
property for controlling layout.
The display Property
• The display property specifies if/how an element
is displayed.
• Every HTML element has a default display value
depending on what type of element it is. The
default display value for most elements is block
or inline.
Block-level Elements
A block-level element always starts on a new line
and takes up the full width available (stretches
out to the left and right as far as it can).
• The <div> element is a block-level element.
• Examples of block-level elements:
• <div>
• <h1> - <h6>
• <p>
• <form>
• <header>
• <footer>
• <section>
Inline Elements
• An inline element does not start on a new line
and only takes up as much width as necessary.
• This is an inline <span> element inside a
paragraph.
• Examples of inline elements:
• <span>
• <a>
• <img>
Display: none;
• display: none; is commonly used with
JavaScript to hide and show elements without
deleting and recreating them. Take a look at
our last example on this page if you want to
know how this can be achieved.
• The <script> element uses display: none; as
default.
Override The Default Display Value
• As mentioned, every element has a default
display value. However, you can override this.
• Changing an inline element to a block
element, or vice versa, can be useful for
making the page look a specific way, and still
follow the web standards.
• A common example is making inline <li>
elements for horizontal menus:
• Note: Setting the display property of an
element only changes how the element is
displayed, NOT what kind of element it is. So,
an inline element with display: block; is not
allowed to have other block elements inside it.
• The following example displays <span>
elements as block elements:
• The following example displays <a> elements
as block elements:
Hide an Element - display:none or
visibility:hidden?
• Hiding an element can be done by setting the
display property to none. The element will be
hidden, and the page will be displayed as if
the element is not there:
visibility:hidden; also hides an element.
• However, the element will still take up the
same space as before. The element will be
hidden, but still affect the layout:
What Is XHTML?
• XHTML stands for EXtensible HyperText
Markup Language
• XHTML is almost identical to HTML
• XHTML is stricter than HTML
• XHTML is HTML defined as an XML application
• XHTML is supported by all major browsers
Why XHTML?
• Many pages on the internet contain "bad" HTML.
• This HTML code works fine in most browsers
(even if it does not follow the HTML rules):
• <html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
<p>This is a paragraph
</body>
• Today's market consists of different browser
technologies. Some browsers run on
computers, and some browsers run on mobile
phones or other small devices. Smaller devices
often lack the resources or power to interpret
"bad" markup.
• XML is a markup language where documents
must be marked up correctly (be "well-
formed").
• By combining the strengths of HTML and XML,
XHTML was developed.
• XHTML is HTML redesigned as XML.
The Most Important Differences from
HTML:
Document Structure
• XHTML DOCTYPE is mandatory
• The xmlns attribute in <html> is mandatory
• <html>, <head>, <title>, and <body> are
mandatory
• XHTML Elements
• XHTML elements must be properly nested
• XHTML elements must always be closed
• XHTML elements must be in lowercase
• XHTML documents must have one root
element
• XHTML Attributes
• Attribute names must be in lower case
• Attribute values must be quoted
• Attribute minimization is forbidden
• <!DOCTYPE ....> Is Mandatory
• An XHTML document must have an XHTML
DOCTYPE declaration.
• The <html>, <head>, <title>, and <body>
elements must also be present, and the xmlns
attribute in <html> must specify the xml
namespace for the document.
XHTML Elements Must Be Properly
Nested
• In HTML, some elements can be improperly
nested within each other, like this:
• <b><i>This text is bold and italic</b></i>
• In XHTML, all elements must be properly
nested within each other, like this:
• <b><i>This text is bold and italic</i></b>
XHTML Elements Must Always Be
Closed
This is wrong:
• <p>This is a paragraph
<p>This is another paragraph
• This is correct:
• <p>This is a paragraph</p>
<p>This is another paragraph</p>
Empty Elements Must Also Be Closed
• This is wrong:
• A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy
face">
• This is correct:
A break: <br />
A horizontal rule: <hr />An image: <img
src="happy.gif" alt="Happy face" />
XHTML Elements Must Be In Lower
Case
• This is wrong:
• <BODY>
<P>This is a paragraph</P>
</BODY>
• This is correct:
• <body>
<p>This is a paragraph</p>
</body>
XHTML Attribute Names Must Be In
Lower Case
• This is wrong:
• <table WIDTH="100%">
• This is correct:
• <table width="100%">
Attribute Values Must Be Quoted
This is wrong:
• <table width=100%>
This is correct:
• <table width="100%">
Attribute Minimization Is Forbidden
Wrong:
• <input type="checkbox" name="vehicle" value="car"
checked />
Correct:
• <input type="checkbox" name="vehicle" value="car"
checked="checked" />
Wrong:
• <input type="text" name="lastname" disabled />
Correct:
• <input type="text" name="lastname"
disabled="disabled" />
How to Convert from HTML to XHTML
• Add an XHTML <!DOCTYPE> to the first line of
every page
• Add an xmlns attribute to the html element of
every page
• Change all element names to lowercase
• Close all empty elements
• Change all attribute names to lowercase
• Quote all attribute values
Validate HTML With The W3C
Validator
https://validator.w3.org/
CSS Layout - Horizontal & Vertical
Align
Center Align Elements
• To horizontally center a block element (like
<div>), use margin: auto;
• Setting the width of the element will prevent
it from stretching out to the edges of its
container.
• The element will then take up the specified
width, and the remaining space will be split
equally between the two margins:
Center Align Text
• To just center the text inside an element, use
text-align: center;
• Go for Example : 
Center an Image
• To center an image, use margin: auto; and
make it into a block element:
• Example::
Left and Right Align - Using float
• Another method for aligning elements is to
use the float property:
Example::
• Tip: When aligning elements with float, always
define margin and padding for the <body>
element. This is to avoid visual differences in
different browsers.
Careful for IE
• There is also a problem with IE8 and earlier,
when using float. If the !DOCTYPE declaration
is missing, IE8 and earlier versions will add a
17px margin on the right side. This seems to
be space reserved for a scrollbar. So, always
set the !DOCTYPE declaration when using
float:
Center Vertically - Using padding
• There are many ways to center an element
vertically in CSS. A simple solution is to use
top and bottom padding:
• Example---
• To center both vertically and horizontally, use
padding and text-align: center:
• Example---
Center Vertically - Using line-height
• Another trick is to use the line-height property
with a value that is equal to the height
property.
• Example
CSS Pseudo-classes
• What are Pseudo-classes?
• A pseudo-class is used to define a special state
of an element.
For example, it can be used to:
• Style an element when a user mouses over it
• Style visited and unvisited links differently
• Style an element when it gets focus
Syntax
The syntax of pseudo-classes:
• selector:pseudo-class {
property:value;
}
a:hover{
}
Anchor Pseudo-classes
Example::
Anchor Pseudo-classes
• Note: a:hover MUST come after a:link and
a:visited in the CSS definition in order to be
effective! a:active MUST come after a:hover in
the CSS definition in order to be effective!
Pseudo-class names are not case-sensitive.
• The Ex::
Pseudo-classes and CSS Classes
• Pseudo-classes can be combined with CSS
classes:
• Ex:
• Hover on <div>
• Using the :hover pseudo-class on a <div>
element:
• Ex::
Simple Tooltip Hover
• Hover over a <div> element to show a <p>
element (like a tooltip):
• Ex:
CSS - The :first-child Pseudo-class
• The :first-child pseudo-class matches a
specified element that is the first child of
another element.
• Match the first <p> element
• The selector matches any <p> element that is
the first child of any element:
• Example:
Match the first <i> element in all <p>
elements
Example
• Match all <i> elements in all first child <p>
elements
Example
CSS tutorial chapter 3

Mais conteúdo relacionado

Mais procurados

Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3Divya Tiwari
 
Css Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete NotesEPAM Systems
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)Webtech Learning
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designersSingsys Pte Ltd
 
Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Gheyath M. Othman
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesNosheen Qamar
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4Gheyath M. Othman
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation Salman Memon
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Chris Poteet
 

Mais procurados (20)

Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
Css Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder.com | Cssfounder in
Css Founder.com | Cssfounder in
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
Css
CssCss
Css
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Basic css
Basic cssBasic css
Basic css
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3Web Design Course: CSS lecture 3
Web Design Course: CSS lecture 3
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 
CSS 101
CSS 101CSS 101
CSS 101
 
Css
CssCss
Css
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
CSS
CSSCSS
CSS
 
css.ppt
css.pptcss.ppt
css.ppt
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 

Semelhante a CSS tutorial chapter 3

Introduction to xhtml
Introduction to xhtmlIntroduction to xhtml
Introduction to xhtmlDhairya Joshi
 
HTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptxHTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptxJoelJoseph961925
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sassSean Wolfe
 
Web fundamental concept and tags
Web fundamental concept and tags Web fundamental concept and tags
Web fundamental concept and tags shameen khan
 
FYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcssFYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcssArti Parab Academics
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJSBasic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJSDeepak Upadhyay
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1jeweltutin
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptxDiyonaVas
 
Web forms and html (lect 1)
Web forms and html (lect 1)Web forms and html (lect 1)
Web forms and html (lect 1)Salman Memon
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basicsstarlanter
 
SDP_-_Module_4.ppt
SDP_-_Module_4.pptSDP_-_Module_4.ppt
SDP_-_Module_4.pptssuser568d77
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)ghayour abbas
 
Castro Chapter 11
Castro Chapter 11Castro Chapter 11
Castro Chapter 11Jeff Byrnes
 

Semelhante a CSS tutorial chapter 3 (20)

Lab1_HTML.pptx
Lab1_HTML.pptxLab1_HTML.pptx
Lab1_HTML.pptx
 
Introduction to xhtml
Introduction to xhtmlIntroduction to xhtml
Introduction to xhtml
 
Xhtml
XhtmlXhtml
Xhtml
 
HTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptxHTML_css_web__tech___nology_______________.pptx
HTML_css_web__tech___nology_______________.pptx
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 
Web fundamental concept and tags
Web fundamental concept and tags Web fundamental concept and tags
Web fundamental concept and tags
 
FYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcssFYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcss
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJSBasic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
Web technology
Web technologyWeb technology
Web technology
 
Html and css
Html and cssHtml and css
Html and css
 
ppt.ppt
ppt.pptppt.ppt
ppt.ppt
 
Advanced CSS.pptx
Advanced CSS.pptxAdvanced CSS.pptx
Advanced CSS.pptx
 
Web forms and html (lect 1)
Web forms and html (lect 1)Web forms and html (lect 1)
Web forms and html (lect 1)
 
Summary of-xhtml-basics
Summary of-xhtml-basicsSummary of-xhtml-basics
Summary of-xhtml-basics
 
SDP_-_Module_4.ppt
SDP_-_Module_4.pptSDP_-_Module_4.ppt
SDP_-_Module_4.ppt
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)
 
Castro Chapter 11
Castro Chapter 11Castro Chapter 11
Castro Chapter 11
 

Último

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Último (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

CSS tutorial chapter 3

  • 1. CSS Tables Table Borders • To specify table borders in CSS, use the border property. • Example  • Notice that the table in the example above has double borders. This is because both the table and the <th> and <td> elements have separate borders.
  • 2. Collapse Table Borders • The border-collapse property sets whether the table borders should be collapsed into a single border: • Example  ----- • If you only want a border around the table, only specify the border property for <table> • Example  -----
  • 3. Table Width and Height • Width and height of a table are defined by the width and height properties. • Example ::::
  • 4. Horizontal Alignment • The text-align property sets the horizontal alignment (like left, right, or center) of the content in <th> or <td>. • By default, the content of <th> elements are center-aligned and the content of <td> elements are left-aligned. • Example:: 
  • 5. Vertical Alignment • The vertical-align property sets the vertical alignment (like top, bottom, or middle) of the content in <th> or <td>. • By default, the vertical alignment of the content in a table is middle (for both <th> and <td> elements) • Ex::::
  • 6. Table Padding • To control the space between the border and the content in a table, use the padding property on <td> and <th> elements: • Example 
  • 7. Horizontal Dividers • Add the border-bottom property to <th> and <td> for horizontal dividers: • Example
  • 8. Hoverable Table • Use the :hover selector on <tr> to highlight table rows on mouse over: • Ex 
  • 9. Striped Tables • For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows: • Ex::
  • 10. Table Color • This example specifies the background color and text color of <th> elements: • -
  • 11. Responsive Table • A responsive table will display a horizontal scroll bar if the screen is too small to display the full content: • Ex::
  • 12. CSS Layout - float and clear The float Property • In its simplest use, the float property can be used to wrap text around images. • The following example specifies that an image should float to the right in a text:
  • 13. The clear Property • The clear property is used to control the behavior of floating elements. • Elements after a floating element will flow around it. To avoid this, use the clear property. • The clear property specifies on which sides of an element floating elements are not allowed to float:
  • 14. Web Layout Example • It is common to do entire web layouts using the float property: • Ex: 
  • 15. CSS Layout - inline-block The inline-block Value • It has been possible for a long time to create a grid of boxes that fills the browser width and wraps nicely (when the browser is resized), by using the float property. • However, the inline-block value of the display property makes this even easier. • inline-block elements are like inline elements but they can have a width and a height.
  • 16. Examples • The old way - using float (notice that we also need to specify a clear property for the element after the floating boxes): • The same effect can be achieved by using the inline-block value of the display property (notice that no clear property is needed):
  • 17. CSS Layout - The display Property • The display property is the most important CSS property for controlling layout. The display Property • The display property specifies if/how an element is displayed. • Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.
  • 18. Block-level Elements A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). • The <div> element is a block-level element. • Examples of block-level elements: • <div> • <h1> - <h6> • <p> • <form> • <header> • <footer> • <section>
  • 19. Inline Elements • An inline element does not start on a new line and only takes up as much width as necessary. • This is an inline <span> element inside a paragraph. • Examples of inline elements: • <span> • <a> • <img>
  • 20. Display: none; • display: none; is commonly used with JavaScript to hide and show elements without deleting and recreating them. Take a look at our last example on this page if you want to know how this can be achieved. • The <script> element uses display: none; as default.
  • 21. Override The Default Display Value • As mentioned, every element has a default display value. However, you can override this. • Changing an inline element to a block element, or vice versa, can be useful for making the page look a specific way, and still follow the web standards. • A common example is making inline <li> elements for horizontal menus:
  • 22. • Note: Setting the display property of an element only changes how the element is displayed, NOT what kind of element it is. So, an inline element with display: block; is not allowed to have other block elements inside it.
  • 23. • The following example displays <span> elements as block elements: • The following example displays <a> elements as block elements:
  • 24. Hide an Element - display:none or visibility:hidden? • Hiding an element can be done by setting the display property to none. The element will be hidden, and the page will be displayed as if the element is not there: visibility:hidden; also hides an element. • However, the element will still take up the same space as before. The element will be hidden, but still affect the layout:
  • 25. What Is XHTML? • XHTML stands for EXtensible HyperText Markup Language • XHTML is almost identical to HTML • XHTML is stricter than HTML • XHTML is HTML defined as an XML application • XHTML is supported by all major browsers
  • 26. Why XHTML? • Many pages on the internet contain "bad" HTML. • This HTML code works fine in most browsers (even if it does not follow the HTML rules): • <html> <head> <title>This is bad HTML</title> <body> <h1>Bad HTML <p>This is a paragraph </body>
  • 27. • Today's market consists of different browser technologies. Some browsers run on computers, and some browsers run on mobile phones or other small devices. Smaller devices often lack the resources or power to interpret "bad" markup. • XML is a markup language where documents must be marked up correctly (be "well- formed"). • By combining the strengths of HTML and XML, XHTML was developed. • XHTML is HTML redesigned as XML.
  • 28. The Most Important Differences from HTML: Document Structure • XHTML DOCTYPE is mandatory • The xmlns attribute in <html> is mandatory • <html>, <head>, <title>, and <body> are mandatory
  • 29. • XHTML Elements • XHTML elements must be properly nested • XHTML elements must always be closed • XHTML elements must be in lowercase • XHTML documents must have one root element • XHTML Attributes • Attribute names must be in lower case • Attribute values must be quoted • Attribute minimization is forbidden
  • 30. • <!DOCTYPE ....> Is Mandatory • An XHTML document must have an XHTML DOCTYPE declaration. • The <html>, <head>, <title>, and <body> elements must also be present, and the xmlns attribute in <html> must specify the xml namespace for the document.
  • 31. XHTML Elements Must Be Properly Nested • In HTML, some elements can be improperly nested within each other, like this: • <b><i>This text is bold and italic</b></i> • In XHTML, all elements must be properly nested within each other, like this: • <b><i>This text is bold and italic</i></b>
  • 32. XHTML Elements Must Always Be Closed This is wrong: • <p>This is a paragraph <p>This is another paragraph • This is correct: • <p>This is a paragraph</p> <p>This is another paragraph</p>
  • 33. Empty Elements Must Also Be Closed • This is wrong: • A break: <br> A horizontal rule: <hr> An image: <img src="happy.gif" alt="Happy face"> • This is correct: A break: <br /> A horizontal rule: <hr />An image: <img src="happy.gif" alt="Happy face" />
  • 34. XHTML Elements Must Be In Lower Case • This is wrong: • <BODY> <P>This is a paragraph</P> </BODY> • This is correct: • <body> <p>This is a paragraph</p> </body>
  • 35. XHTML Attribute Names Must Be In Lower Case • This is wrong: • <table WIDTH="100%"> • This is correct: • <table width="100%">
  • 36. Attribute Values Must Be Quoted This is wrong: • <table width=100%> This is correct: • <table width="100%">
  • 37. Attribute Minimization Is Forbidden Wrong: • <input type="checkbox" name="vehicle" value="car" checked /> Correct: • <input type="checkbox" name="vehicle" value="car" checked="checked" /> Wrong: • <input type="text" name="lastname" disabled /> Correct: • <input type="text" name="lastname" disabled="disabled" />
  • 38. How to Convert from HTML to XHTML • Add an XHTML <!DOCTYPE> to the first line of every page • Add an xmlns attribute to the html element of every page • Change all element names to lowercase • Close all empty elements • Change all attribute names to lowercase • Quote all attribute values
  • 39. Validate HTML With The W3C Validator https://validator.w3.org/
  • 40. CSS Layout - Horizontal & Vertical Align Center Align Elements • To horizontally center a block element (like <div>), use margin: auto; • Setting the width of the element will prevent it from stretching out to the edges of its container. • The element will then take up the specified width, and the remaining space will be split equally between the two margins:
  • 41. Center Align Text • To just center the text inside an element, use text-align: center; • Go for Example : 
  • 42. Center an Image • To center an image, use margin: auto; and make it into a block element: • Example::
  • 43. Left and Right Align - Using float • Another method for aligning elements is to use the float property: Example:: • Tip: When aligning elements with float, always define margin and padding for the <body> element. This is to avoid visual differences in different browsers.
  • 44. Careful for IE • There is also a problem with IE8 and earlier, when using float. If the !DOCTYPE declaration is missing, IE8 and earlier versions will add a 17px margin on the right side. This seems to be space reserved for a scrollbar. So, always set the !DOCTYPE declaration when using float:
  • 45. Center Vertically - Using padding • There are many ways to center an element vertically in CSS. A simple solution is to use top and bottom padding: • Example--- • To center both vertically and horizontally, use padding and text-align: center: • Example---
  • 46. Center Vertically - Using line-height • Another trick is to use the line-height property with a value that is equal to the height property. • Example
  • 47. CSS Pseudo-classes • What are Pseudo-classes? • A pseudo-class is used to define a special state of an element. For example, it can be used to: • Style an element when a user mouses over it • Style visited and unvisited links differently • Style an element when it gets focus
  • 48. Syntax The syntax of pseudo-classes: • selector:pseudo-class { property:value; } a:hover{ } Anchor Pseudo-classes Example::
  • 49. Anchor Pseudo-classes • Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective! a:active MUST come after a:hover in the CSS definition in order to be effective! Pseudo-class names are not case-sensitive. • The Ex::
  • 50. Pseudo-classes and CSS Classes • Pseudo-classes can be combined with CSS classes: • Ex: • Hover on <div> • Using the :hover pseudo-class on a <div> element: • Ex::
  • 51. Simple Tooltip Hover • Hover over a <div> element to show a <p> element (like a tooltip): • Ex:
  • 52. CSS - The :first-child Pseudo-class • The :first-child pseudo-class matches a specified element that is the first child of another element. • Match the first <p> element • The selector matches any <p> element that is the first child of any element: • Example:
  • 53. Match the first <i> element in all <p> elements Example • Match all <i> elements in all first child <p> elements Example