+ 3

<style> use in head ? Why ?

I have learn with challenge that style’s tag can be used in head but i don’t understand why and the utility to make it Thanks for answer :)

8th Feb 2019, 8:21 AM
Axel Slb
Axel Slb - avatar
10 Answers
+ 7
Style tag is used for CSS. We can add CSS to a page in three ways, external, internal and inline. When we put <style> in head (recommended way), we actually add CSS internally. It's often used when we want to make specific change to the page that is already being affected by external CSS, because priority of internal is higher than that of external For example when you add bootstrap.css as external CSS to all your html pages, you may want to make font size of your contact.html a little bigger instead of what is defined in bootstrap.css. If you edit bootstrap.css, you'll see all pages affected, but adding internal style will affect that particular page only.
8th Feb 2019, 8:38 AM
Kawalpreet Juneja
Kawalpreet Juneja - avatar
+ 5
Yes it's recommended. But putting it in <body> is OK too
8th Feb 2019, 8:48 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Axel Salenbier you can use it in both <head> and <body>. But it's better to use in <head>.
10th Feb 2019, 6:11 AM
DIPTIRANI SAHU
+ 4
https://code.sololearn.com/W5Nq53nYiG8j/?ref=app Take a look here, as u can see all paragraphs will have color yellow and later you can easily change it just there. Inline styles you should use only for styling particular thing on a page. In head/style you will create classes and style all elemetnts on a page
8th Feb 2019, 8:32 AM
Dejan Dozet
Dejan Dozet - avatar
+ 3
<style> SHOULD be used in head by right.
8th Feb 2019, 8:41 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
thanks :)
8th Feb 2019, 8:38 AM
Axel Slb
Axel Slb - avatar
+ 2
Okay thanks for your help ^^
8th Feb 2019, 8:50 AM
Axel Slb
Axel Slb - avatar
+ 2
Firstly prefer external css,which is used in head section. Secondly it is not the preferred way to write inline css in the body section. Thirdly for the Readability and Modularity thing because it will make more efficient and would look more professional by using style tag in head section.
8th Feb 2019, 9:05 PM
Shubham Chaurasiya
Shubham Chaurasiya - avatar
+ 1
it’s recommended ? i think the better way was to create an external css
8th Feb 2019, 8:43 AM
Axel Slb
Axel Slb - avatar
+ 1
Wow
13th Feb 2019, 5:30 PM
ProMethusPro