Css tags not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Css tags not working?

im quite new to css as I just finished html. So im testing the style/size paragraph tags but its not working. Can somebody link a reference for what im trying to do in comments?

20th Jan 2021, 3:19 PM
Ducky
Ducky - avatar
9 Answers
+ 4
It would be better to use an external style sheet I think.
22nd Jan 2021, 1:34 AM
Sonic
Sonic - avatar
+ 2
It depends. CSS would be done in a separate CSS file that is linked to your HTML page, specifically linked in the head tag of your HTML markup. If you are trying to get styling done in the paragraph HTML tag, you need to specify an attribute for style inside the <p> tag. You can specify more than one style property. As follows: <p style="font-size:10px; color: blue"> This is a paragraph </p> you can also add a <style> tag and specify your CSS in there. The syntax will be 'key:value' pairs. After the selector tag and code block. Such as: p { color: blue; font-size: 10px; } "p" is the selector. The brackets are the code block. The css properties and values go inside the code block. This same 'key:value' syntax is used in a CSS stylesheet as well.
20th Jan 2021, 3:36 PM
Ivan Kotze
+ 2
Yes, but your code becomes super long and difficult to navigate if everything (HTML, JS and CSS) are all on the same page. That's why it's good to keep them separate, But it's a good practice either way. So yes, in the head of your HTML add: <style>         p {      font-size: 10px;      color: blue;   } </style> When you specify a class, a period at the star of the selector defines it is a class. An element with an ID will have a '#' at the start of the selector tag, to specify an element with an ID.
20th Jan 2021, 3:54 PM
Ivan Kotze
+ 2
You're welcome dude 😁
20th Jan 2021, 3:55 PM
Ivan Kotze
+ 1
There's no 'tags' in css... roughly only selectors, properties and values... There's a 'style tag' in html... to embed css rules declarations... There's also a 'style attribute' in 'html tags'... to embed specific css rules... To style all paragraphs, you should use the simple 'p' selector (all <p> tags in html content) in either embeded style tag or linked css: p { font-size: 2em; }
20th Jan 2021, 3:31 PM
visph
visph - avatar
+ 1
oh ok so what im getting is I need to specify the css with <style> right?
20th Jan 2021, 3:38 PM
Ducky
Ducky - avatar
+ 1
ohh ok I got it now, thanks
20th Jan 2021, 3:44 PM
Ducky
Ducky - avatar
+ 1
thanks!
20th Jan 2021, 3:55 PM
Ducky
Ducky - avatar