+ 1
why not Write Style element in Head like <head> <style>..</style> </head>
Why don't we use element <style> with wanted formatting </style> instead of typing many formatting elements before the text.
3 Réponses
+ 1
Html is used to lay out the format of a page. This section is a paragraph, and this is another paragraph. We then use Css to add the style. First paragraph has blue text, second paragraph has green text. The Css can be used on multiple pages so all the style is the same. And, if you need to make a change, like changing the first paragraph text to red, you only have to make the change in the Css file.
The only time I would ever put style in the head is if this is a one page site.
+ 1
Usually the best way to go about style is to use an external CSS file like styles.css then link it in the HTML file like this...
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
</html>
This makes it easier to find all your styles, since they are all in one place rather than looking through your HTML code.
- 1
I'm not particularly experienced, but I would think that it depends on the situation. Sometimes, it's just quicker to write tags around a certain phrase or use inline CSS, but if you want to use CSS over and over, it might be better to use style tags in the head. Also, as the people above have stated, unless the website is only one page, it's probably best to keep all your styling in another file entirely.