CSS clear Property example
The CSS clear property is used to clear space for an element that has preceding elements that use the float property.
Possible Values
- left- No floating elements allowed on the left side
- right- No floating elements allowed on the right side
- both- No floating elements allowed on either the left or the right side
- none- Default. Allows floating elements on both sides.
- <html>
- <head>
- <title>Styling Text</title>
- <style type="text/css">
- #div1 {float: left; background: #F0F; width: 260px; height: 120px;}
- #div2 {clear: left; background: #0FF; width: 260px; height: 120px;}
- </style>
- </head>
- <body>
- <div id="div1">div content ...</div>
- <div id="div2">div content ...</div>
- </body>
- </html>

CSS color Property example
The CSS color property is used to specify the foreground color for the text inside your elements.
- <style type="text/css">
- #p1{ color:#099;}
- </style>
- <p id="p1">This is my paragraph....</p>
CSS display property example
The CSS display property is used to alter the default display behavior of elements.
"Block display" elements cannot be laid side-by-side horizontally unless you apply the float property to them for strategic positioning.
While other elements are "inline display" elements, that are side-by-side horizontally by default.
CSS float property example
The CSS float property is used to float elements to a specific side. You can strategically float block elements and specify widths, heights, and margins for them.
- <style type="text/css">
- .columnLayout{ float: left;background: #BFFFFF;padding: 12px;width: 120px;height: 240px;margin: 5px;}
- .columnLayout:hover{ border: #00D2D2 1px solid;}
- </style>
- <div class="columnLayout"></div>
- <div class="columnLayout"></div>
- <div class="columnLayout"></div>

or
- <style type="text/css">
- #div1{ float: left;background: #BFFFFF;padding: 12px;width: 120px;height: 60px;}
- #div1:hover{border: red 1px solid; }
- #div2{ float: right;background: #FFD9F8;padding: 12px;width: 120px;height: 60px;}
- #div2:hover{border: red 1px solid; }
- </style>
- <div id="div1">div content ...</div>
- <div id="div2">div content ...</div>

CSS font Property
CSS font-family Property example
The CSS font-family property is used to define a font family for an element. It will also affect any child elements of the specified element.
- <style type="text/css">
- p{ font-size:18px;}
- #p1{ font-family: "Comic Sans MS", "Trebuchet MS", Arial;}
- #p1:hover{ color:Red;}
- #p2{ font-family: "Arial Black", Impact, Verdana;}
- #p2:hover{ color:Green;}
- #p3{ font-family: Georgia, "Times New Roman", serif;}
- #p3:hover{ color:pink;}
- </style>
- <p id="p1">paragraph content ...</p>
- <p id="p2">paragraph content ...</p>
- <p id="p3">paragraph content ...</p>

CSS font-size Property example
The CSS font-size property is used to specify the size of the text inside of elements.
- <style type="text/css">
- #p1 { font-size: 12px; }
- #p1:hover{ font-size: 14px; color:Red; }
- #p2 { font-size: larger; }
- #p2:hover{ font-size: 16px; color:Green; }
- #p3 { font-size: x-large; }
- #p3:hover{ font-size: 18px; color:Blue; }
- #p4 { font-size: 200%; }
- #p4:hover{ font-size: 20px; color: Maroon; }
- </style>
- <p id="p1">Paragraph content ...</p>
- <p id="p2">Paragraph content ...</p>
- <p id="p3">Paragraph content ...</p>
- <p id="p4">Paragraph content ...</p>

CSS font-style Property
The CSS font-style property is used to specify italic or oblique font faces of text in an element.
- <style type="text/css">
- #p1{ font-style: italic;}
- </style>
- <p id="p5">Paragraph content ...</p>
CSS font-variant Property example
The CSS font-variant property is used to specify that all lowercase letters be replaced by small capital letters.
The lowercase letters will become capitalized while keeping their small size in proportion to the actual capital letters.
- <style type="text/css">
- h2 { font-variant:small-caps;}
- </style>
- <h2>This is my section heading</h2>
CSS font-weight Property example
The CSS font-weight property is used to specify the thickness of the font.
- <style type="text/css">
- .myClass { font-weight: 600;}
- </style>
- <p class="myClass">paragraph content ...</p>
- <p>paragraph content ...</p>

CSS font property example
The CSS font property is CSS shorthand for specifying font-style, font-variant, font-weight, font-size and font-family properties.
- <style type="text/css">
- p.myClass { font: italic small-caps bold 18px Arial, Verdana;}
- p.myClass:hover{ color:Red;}
- </style>
- <p>Paragraph Content</p>
- <p class="myClass">Paragraph Content</p>

CSS height Property example
The CSS height property is used to specify the height setting that some content containers can receive.
This only works on elements that are "block" display type content boxes.
For instance if you try to set the height on an <span> element, by default, it will not adhere to your height property, but if you try to set height for an <div> element it will adhere to the height property.
- <style type="text/css">
- #myDiv { height: 50%; /* use %, exact pixel size, or auto */width: 75%;border: #59ACFF 1px solid;background: #CCE6FF;padding: 12px; color:Green;}
- </style>
- <div id="myDiv">Sonia</div>

CSS letter-spacing Property example
The CSS letter-spacing property is used to specify the amount of space that your text should have between each letter.
Use this with the word-spacing and line-height properties to really fine-tune your font and text rendering for better readability.
- <style type="text/css">
- p.class1 { letter-spacing: 0.3em;}
- p.class1:hover{ color:Red;}
- p.class2 { letter-spacing: 4px;}
- p.class2:hover{ color:Green;}
- </style>
- <p class="class1">Sonia</p>
- <p class="class2">Sonia</p>
- <p>Sonia</p>

CSS line-height Property example
The CSS line-height property is used to specify the amount of space between each new line of text and the height of line breaks.
Use this with the word-spacing and letter-spacing properties to really fine-tune your font and text rendering for better readability.
- <style type="text/css">
- p.class1 { line-height: 2.5em; color:Red;}
- p.class2 { line-height: 50px; color:Green;}
- p.class3 { line-height: 300%; color:Blue;}
- </style>
- <p>Sonia <br /> and more <br /> and more</p>
- <hr />
- <p class="class1">Sonia <br /> and more <br /> and more</p>
- <hr />
- <p class="class2">Sonia <br /> and more <br /> and more</p>
- <hr />
- <p class="class3">Sonia <br /> and more <br /> and more</p>

CSS list-style Property
CSS list-style-position Property example
The CSS list-style-position property is used to specify the position of list item markers and their content.
- <style type="text/css">
- #list1 { list-style-position: outside;}
- #list2 { list-style-position: inside;}
- </style>
- <ul id="list1">
- <li>My list item</li>
- <li>Another list item</li>
- <li>Final list item</li>
- </ul>
- <ul id="list2">
- <li>My list item</li>
- <li>Another list item</li>
- <li>Final list item</li>
- </ul>
- <ul id="list3">
- <li>My list item</li>
- <li>Another list item</li>
- <li>Final list item</li>
- </ul>

CSS list-style-type Property example
The type of list item marker is specified with the list-style-type property.
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- ul.a {list-style-type:circle;}
- ul.b {list-style-type:square;}
- ol.c {list-style-type:upper-roman;}
- ol.d {list-style-type:lower-alpha;}
- </style>
- </head>
- <body>
- <p>Example of unordered lists:</p>
- <ul class="a">
- <li>Coffee</li>
- <li>Tea</li>
- <li>Coca Cola</li>
- </ul>
- <ul class="b">
- <li>Coffee</li>
- <li>Tea</li>
- <li>Coca Cola</li>
- </ul>
- <p>Example of ordered lists:</p>
- <ol class="c">
- <li>Coffee</li>
- <li>Tea</li>
- <li>Coca Cola</li>
- </ol>
- <ol class="d">
- <li>Coffee</li>
- <li>Tea</li>
- <li>Coca Cola</li>
- </ol>
- </body>
- </html>

















Comments
Join the conversation! Your thoughts help the community grow.