HTML Style
Style Sheets, is a tool that defines how web documents look on screens or in print. Since its introduction in 1994, the W3C has encouraged the use of style sheets for web design, Setting the style of an HTML element, can be done with the style
attribute.
The HTML style
attribute has the following syntax:
HTML Style
<!DOCTYPE html> <html> <head> <title>HTML Internal CSS</title> <style type="text/css"> .red { color: red; } .thick { font-size: 20px; } .green { color: green; } </style> </head> <body> <p class="red">This is red</p> <p class="thick">This is thick</p> <p class="green">This is green</p> <p class="thick green">This is thick and green</p> </body> </html>
- The browser default
- Styles defined in the page
- Some styles will inherit a style to their childs, for example which font to use
- The last rule to be defined in the loading order will be the one that will kick into effect
- The element selector (for example, styling all
<footer>
elements) - The class selector (for example, styling all
.main
elements) - The ID selector, used to select a specific element in the page