CSS Examples
1. Background image and text positioning using CSS.
Example:
<!DOCTYPE html> <html> <head> <style>
| body | |
| { | |
| margin-left:200px; | |
| background:#5d9ab2 url('img_tree.jpg') no-repeat top left; | |
| } | |
| .container | |
| { | |
| text-align:center; | |
| } | |
| .center_div | |
| { | |
| border:1px solid gray; | |
| margin-left:auto; | |
| margin-right:auto; | |
| width:90%; | |
| background-color:#d0f0f6; | |
| text-align:left; | |
| padding:8px; | |
| } |
| <div class="container"> | |
| <div class="center_div"> | |
| <h1>Hello World!</h1> | |
| <p>This example contains some advanced CSS methods you may not have learned yet. But, we will explain these methods in a later chapter in the tutorial.</p> | |
| </div> | |
| </div> |
Example:
2. CSS text-align Example.
| <!DOCTYPE html> | |
| <head> | |
| <style> | |
| h1 {text-align:center;} | |
| p.date {text-align:right;} | |
| p.main {text-align:justify;} | |
| </style> | |
| </head> | |
| <body> | |
| <h1>CSS text-align Example</h1> | |
| <p class="date">May, 2009</p> | |
| <p class="main">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, | |
| 'just remember that all the people in this world haven't had the advantages that you've had.'</p> | |
| <p><b>Note:</b> Resize the browser window to see how the value "justify" works.</p> | |
| </body> | |
| </html> | |
3. CSS Dropcap Example.
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| p:first-letter | |
| { | |
| color:#ff0000; | |
| font-size:xx-large; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <p>You can use the :first-letter pseudo-element to add a special effect to the first character of a text!</p> | |
| </body> | |
| </html> | |
4. CSS gif bullet symbol Example.
|
4. CSS Menu link Example.
|


0 Comments