Placing CSS information on an HTML page
css, html
Solution
You can use
<link rel="stylesheet" type="text/css" href="style.css" />
in the head to link to an external stylesheet.
You can also have inline style attributes, such as
<a href="#" style="color:red">Hello</a>
And you can also set the styles in your scripts, e.g. using jQuery (which can go where ever your script is):
$('textBox').css("font-weight", "bold");
However, it is good practise to try to keep all the style information in one standard spot, i.e. the head of the document - it makes it easier for others to maintain your work for you.
Note that if you really want to override a particular attribute, the best way to do it is to use the !important option, such as
color: red !important;
You can use this with any of the methods listed above, and it will override any later settings that conflict.
Problem
Where are all of the places you can put CSS style information on an HTML page? I know you can place CSS style info in the head of an HTML page, where else is it valid to put CSS elements? I would like to place my CSS someplace else on the page due to inheritance, e.g: ``` <style type="text/css"> ... </style> ```