why not Write Style element in Head like <head> <style>..</style> </head> | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 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.

4th Oct 2016, 6:05 PM
Ahmed Awwad
Ahmed Awwad - avatar
3 Respuestas
+ 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.
6th Oct 2016, 12:25 AM
Emma Willmann
Emma Willmann - avatar
+ 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.
23rd Oct 2016, 3:02 PM
Brandon Gonzales
Brandon Gonzales - avatar
- 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.
22nd Jan 2017, 4:49 PM
Delaina Hardwick
Delaina Hardwick - avatar