SlideShare uma empresa Scribd logo
1 de 8
Lecture 22
Nesting
        If CSS is structured well, there should not be a need to use of many Class ID or
selectors.
        For example:

#top {
           background-color: #ccc;
           padding: 1em
}

#top h1 {
        color: #ff0;
}

#top p {
           color: red;
           font-weight: bold;
}

Now h1 contains the “attribute:value” pair of selector ID “#top” also, and another
“attribute:value” pair i.e. “color:#ff0”.

CSS Dimension Properties
I: How to Set the Width and Height of an image
<html>
<head>

<style type="text/css">
img.normal
{
height: auto;
width: auto
}

img.big
{
height: 80px;
width: 100px
}

img.small
{
height: 30px;
width: 50px
}
</style>

</head>

<body>
<p><b>Note:</b> Netscape 4 does not support the "height" property, and the
"width"
property does not work on images.</p>

<img class="normal" src="back.gif" width="72" height="40">
<br><br>
<img class="big" src="back.gif" width="72" height="40">
<br><br>
<img class="small" src="back.gif" width="72" height="40">

</body>
</html>



Dimension Properties:
NN: Netscape, IE: Internet Explorer, W3C: Web Standard

Property           Description             Values            Example
height             Sets the height of an   auto              img
                   element                 length            {
                                           %                 height: 230px
                                                             }
line-height        Sets the distance       normal            p
                   between lines           number            {
                                           length            max-height: 100px
                                           %                 }
max-height         Sets the maximum        none
                   height of an element    length
                                           %
max-width          Sets the maximum width none                h2
                   of an element          length             {
                                          %                  max-width: 500px
                                                             }
min-height         Sets the minimum height length             p
                   of an element           %                 {
                                                             min-height: 10px
                                                             }
min-width          Sets the minimum width length              h2
                   of an element          %                  {
                                                             min-width: 50px
                                                             }
width              Sets the width of an    auto              Refer example
                   element                 %                 below
length



CSS Classification Properties
          The classification property allows you to control
    1.    How to display an element.
    2.    Set where an image will appear in another element.
    3.    Position an element relative to its normal position.
    4.    Position an element using an absolute value.
    5.    To control the visibility of an element

Property                Description                 Values
clear                   Sets the sides of an        left
                        element where other         right
                        floating elements are not   both
                        allowed                     none
cursor                  Specifies the type of       url             h2
                        cursor to be displayed      auto            {
                                                    crosshair       cursor:
                                                    default         crosshair
                                                    pointer         }
                                                    move
                                                    e-resize
                                                    ne-resize
                                                    nw-resize
                                                    n-resize
                                                    se-resize
                                                    sw-resize
                                                    s-resize
                                                    w-resize
                                                    text
                                                    wait
                                                    help
display                 Sets how/if an element is none
                        displayed                 inline
                                                  block
                                                  list-item
                                                  run-in
                                                  compact
                                                  marker
                                                  table
                                                  inline-table
                                                  table-row-group
table-header-group
                                                table-footer-group
                                                table-row
                                                table-column-group
                                                table-column
                                                table-cell
                                                table-caption
float              Sets where an image or a left                     Refer
                   text will appear in      right                    example
                   another element          none                     below
position           Places an element in a       static
                   static, relative, absolute   relative
                   or fixed position            absolute
                                                fixed
visibility         Sets if an element should visible
                   be visible or invisible   hidden
                                             collapse

Creating a Horizontal menu
    <html>
    <head>
    <style type="text/css">
    body
    {
    cursor: e-resize
    }
    ul
    {
    float:left;
    width:100%;
    padding:0;
    margin:0;
    list-style-type:none;
    }
    a
    {
    float:left;
    width:6em;
    text-decoration:none;
    color:white;
    background-color:purple;
    padding:0.2em 0.6em;
    border-right:1px solid white;
    }
    a:hover {background-color:#ff3300}
    li {display:inline}
    </style>
    </head>

    <body>
    <ul>
    <li><a href="#">Link one</a></li>
<li><a href="#">Link two</a></li>
   <li><a href="#">Link three</a></li>
   <li><a href="#">Link four</a></li>
   </ul>

   <p>
   In the example above, we let the ul element and the a element float to
   the left.
   The li elements will be displayed as inline elements (no line break
   before or after the element). This forces the list to be on one line.
   The ul element has a width of 100% and each hyperlink in the list has a
   width of 6em (6 times the size of the current font).
   We add some colors and borders to make it more fancy.
   </p>

   </body>
   </html>

An Example of Float
<html>
<head>
<style type="text/css">
img
{
float:right
}
</style>
</head>
<body>

<p>
In the paragraph below, we have added an image with style
<b>float:right</b>. The result is that the image will float to the right in
the paragraph.
</p>

<p>
<img   src="logocss.gif" width="95" height="84"   />
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
This   is some text. This is some text. This is   some   text.
</p>

</body>
</html>

Another Example on the same line of Float
<html>
<head>
<style type="text/css">
div
{
float:right;
width:120px;
margin:0 0 15px 20px;
padding:15px;
border:1px solid black;
text-align:center;
}
</style>
</head>

<body>
<div>
<img src="logocss.gif" width="95" height="84"   /><br />
CSS is fun!
</div>
<p>
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
This is some text. This is some text. This is   some   text.
</p>

<p>
In the paragraph above, the div element is 120 pixels wide and it contains
the image.
The div element will float to the right.
Margins are added to the div to push the text away from the div.
Borders and padding are added to the div to frame in the picture and the
caption.
</p>

</body>
</html>

A Home Page without Using Tables
<html>
<head>
<style type="text/css">
div.container
{
width:100%;
margin:0px;
border:1px solid gray;
line-height:150%;
}
div.header,div.footer
{
padding:0.5em;
color:white;
background-color:gray;
clear:left;
}
h1.header
{
padding:0;
margin:0;
}
div.left
{
float:left;
width:160px;
margin:0;
padding:1em;
}
div.content
{
margin-left:190px;
border-left:1px solid gray;
padding:1em;
}
</style>
</head>
<body>

<div class="container">
<div class="header"><h1 class="header">kumarharmuscat.tripod.com</h1></div>
<div class="left"><p>"Never increase, beyond what is necessary, the number
of entities required to explain anything." William of Ockham
(1285-1349)</p></div>
<div class="content">
<h2>Free Web Building Tutorials</h2>
<p>At My Site you will find all the Web-building tutorials you need,
from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.</p>
<p>W3Schools - The Largest Web Developers Site On The Net!</p></div>
<div class="footer">Copyright 1999-2005 by Harshit Kumar</div>
</div>

</body>
</html>


Pseudo Classes
       The syntax for Pseudo Class is
Selector:pseudoclass
{
       attribute1: value1;
       attribute2: value2;
       .
       .
       attributen: valuen;
}

a.snowman:link {
color: blue;
}

a.snowman:visited {
        color: purple;
}

a.snowman:active {
        color: red;
}

a.snowman:hover {
        text-decoration: none;
        color: blue;
        background-color: yellow;
}

Mais conteúdo relacionado

Semelhante a Css 2

Semelhante a Css 2 (14)

Web Layout
Web LayoutWeb Layout
Web Layout
 
CSS Cheatsheet
CSS CheatsheetCSS Cheatsheet
CSS Cheatsheet
 
Art of css
Art of cssArt of css
Art of css
 
javascript web developpement framework web
javascript web developpement framework webjavascript web developpement framework web
javascript web developpement framework web
 
basics of css
basics of cssbasics of css
basics of css
 
CSS3 Refresher
CSS3 RefresherCSS3 Refresher
CSS3 Refresher
 
Introduction 2 css
Introduction 2 cssIntroduction 2 css
Introduction 2 css
 
07. session 07 adv css properties
07. session 07   adv css properties07. session 07   adv css properties
07. session 07 adv css properties
 
Css advanced – session 4
Css advanced – session 4Css advanced – session 4
Css advanced – session 4
 
Deep Dive into Line-Height
Deep Dive into Line-HeightDeep Dive into Line-Height
Deep Dive into Line-Height
 
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
 
Css Essential
Css EssentialCss Essential
Css Essential
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
 

Mais de H K

Assignment4
Assignment4Assignment4
Assignment4H K
 
Assignment3
Assignment3Assignment3
Assignment3H K
 
Induction
InductionInduction
InductionH K
 
Solution3
Solution3Solution3
Solution3H K
 
Solution2
Solution2Solution2
Solution2H K
 
Mid-
Mid-Mid-
Mid-H K
 
Assignment4
Assignment4Assignment4
Assignment4H K
 
Assignment4
Assignment4Assignment4
Assignment4H K
 
Dm assignment3
Dm assignment3Dm assignment3
Dm assignment3H K
 
Proof
ProofProof
ProofH K
 
Resolution
ResolutionResolution
ResolutionH K
 
Assignment description
Assignment descriptionAssignment description
Assignment descriptionH K
 
Dm assignment2
Dm assignment2Dm assignment2
Dm assignment2H K
 
Set
SetSet
SetH K
 
Dm assignment1
Dm assignment1Dm assignment1
Dm assignment1H K
 
Logic
LogicLogic
LogicH K
 
Introduction
IntroductionIntroduction
IntroductionH K
 
Assignment 2 sol
Assignment 2 solAssignment 2 sol
Assignment 2 solH K
 
Assignment sw solution
Assignment sw solutionAssignment sw solution
Assignment sw solutionH K
 
Violinphoenix
ViolinphoenixViolinphoenix
ViolinphoenixH K
 

Mais de H K (20)

Assignment4
Assignment4Assignment4
Assignment4
 
Assignment3
Assignment3Assignment3
Assignment3
 
Induction
InductionInduction
Induction
 
Solution3
Solution3Solution3
Solution3
 
Solution2
Solution2Solution2
Solution2
 
Mid-
Mid-Mid-
Mid-
 
Assignment4
Assignment4Assignment4
Assignment4
 
Assignment4
Assignment4Assignment4
Assignment4
 
Dm assignment3
Dm assignment3Dm assignment3
Dm assignment3
 
Proof
ProofProof
Proof
 
Resolution
ResolutionResolution
Resolution
 
Assignment description
Assignment descriptionAssignment description
Assignment description
 
Dm assignment2
Dm assignment2Dm assignment2
Dm assignment2
 
Set
SetSet
Set
 
Dm assignment1
Dm assignment1Dm assignment1
Dm assignment1
 
Logic
LogicLogic
Logic
 
Introduction
IntroductionIntroduction
Introduction
 
Assignment 2 sol
Assignment 2 solAssignment 2 sol
Assignment 2 sol
 
Assignment sw solution
Assignment sw solutionAssignment sw solution
Assignment sw solution
 
Violinphoenix
ViolinphoenixViolinphoenix
Violinphoenix
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Último (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Css 2

  • 1. Lecture 22 Nesting If CSS is structured well, there should not be a need to use of many Class ID or selectors. For example: #top { background-color: #ccc; padding: 1em } #top h1 { color: #ff0; } #top p { color: red; font-weight: bold; } Now h1 contains the “attribute:value” pair of selector ID “#top” also, and another “attribute:value” pair i.e. “color:#ff0”. CSS Dimension Properties I: How to Set the Width and Height of an image <html> <head> <style type="text/css"> img.normal { height: auto; width: auto } img.big { height: 80px; width: 100px } img.small { height: 30px; width: 50px } </style> </head> <body>
  • 2. <p><b>Note:</b> Netscape 4 does not support the "height" property, and the "width" property does not work on images.</p> <img class="normal" src="back.gif" width="72" height="40"> <br><br> <img class="big" src="back.gif" width="72" height="40"> <br><br> <img class="small" src="back.gif" width="72" height="40"> </body> </html> Dimension Properties: NN: Netscape, IE: Internet Explorer, W3C: Web Standard Property Description Values Example height Sets the height of an auto img element length { % height: 230px } line-height Sets the distance normal p between lines number { length max-height: 100px % } max-height Sets the maximum none height of an element length % max-width Sets the maximum width none h2 of an element length { % max-width: 500px } min-height Sets the minimum height length p of an element % { min-height: 10px } min-width Sets the minimum width length h2 of an element % { min-width: 50px } width Sets the width of an auto Refer example element % below
  • 3. length CSS Classification Properties The classification property allows you to control 1. How to display an element. 2. Set where an image will appear in another element. 3. Position an element relative to its normal position. 4. Position an element using an absolute value. 5. To control the visibility of an element Property Description Values clear Sets the sides of an left element where other right floating elements are not both allowed none cursor Specifies the type of url h2 cursor to be displayed auto { crosshair cursor: default crosshair pointer } move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help display Sets how/if an element is none displayed inline block list-item run-in compact marker table inline-table table-row-group
  • 4. table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption float Sets where an image or a left Refer text will appear in right example another element none below position Places an element in a static static, relative, absolute relative or fixed position absolute fixed visibility Sets if an element should visible be visible or invisible hidden collapse Creating a Horizontal menu <html> <head> <style type="text/css"> body { cursor: e-resize } ul { float:left; width:100%; padding:0; margin:0; list-style-type:none; } a { float:left; width:6em; text-decoration:none; color:white; background-color:purple; padding:0.2em 0.6em; border-right:1px solid white; } a:hover {background-color:#ff3300} li {display:inline} </style> </head> <body> <ul> <li><a href="#">Link one</a></li>
  • 5. <li><a href="#">Link two</a></li> <li><a href="#">Link three</a></li> <li><a href="#">Link four</a></li> </ul> <p> In the example above, we let the ul element and the a element float to the left. The li elements will be displayed as inline elements (no line break before or after the element). This forces the list to be on one line. The ul element has a width of 100% and each hyperlink in the list has a width of 6em (6 times the size of the current font). We add some colors and borders to make it more fancy. </p> </body> </html> An Example of Float <html> <head> <style type="text/css"> img { float:right } </style> </head> <body> <p> In the paragraph below, we have added an image with style <b>float:right</b>. The result is that the image will float to the right in the paragraph. </p> <p> <img src="logocss.gif" width="95" height="84" /> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> </body> </html> Another Example on the same line of Float <html> <head> <style type="text/css"> div
  • 6. { float:right; width:120px; margin:0 0 15px 20px; padding:15px; border:1px solid black; text-align:center; } </style> </head> <body> <div> <img src="logocss.gif" width="95" height="84" /><br /> CSS is fun! </div> <p> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> <p> In the paragraph above, the div element is 120 pixels wide and it contains the image. The div element will float to the right. Margins are added to the div to push the text away from the div. Borders and padding are added to the div to frame in the picture and the caption. </p> </body> </html> A Home Page without Using Tables <html> <head> <style type="text/css"> div.container { width:100%; margin:0px; border:1px solid gray; line-height:150%; } div.header,div.footer { padding:0.5em;
  • 7. color:white; background-color:gray; clear:left; } h1.header { padding:0; margin:0; } div.left { float:left; width:160px; margin:0; padding:1em; } div.content { margin-left:190px; border-left:1px solid gray; padding:1em; } </style> </head> <body> <div class="container"> <div class="header"><h1 class="header">kumarharmuscat.tripod.com</h1></div> <div class="left"><p>"Never increase, beyond what is necessary, the number of entities required to explain anything." William of Ockham (1285-1349)</p></div> <div class="content"> <h2>Free Web Building Tutorials</h2> <p>At My Site you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.</p> <p>W3Schools - The Largest Web Developers Site On The Net!</p></div> <div class="footer">Copyright 1999-2005 by Harshit Kumar</div> </div> </body> </html> Pseudo Classes The syntax for Pseudo Class is Selector:pseudoclass { attribute1: value1; attribute2: value2; . . attributen: valuen; } a.snowman:link {
  • 8. color: blue; } a.snowman:visited { color: purple; } a.snowman:active { color: red; } a.snowman:hover { text-decoration: none; color: blue; background-color: yellow; }