How do I combine css with html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How do I combine css with html

25th Mar 2021, 9:24 AM
Ahmed Alrsheed
Ahmed Alrsheed - avatar
2 Answers
+ 2
Also you can write the css directly inside html file using <style> tag. For example: <!DOCTYPE html> <html> <head> <style>.my-class { color: red; } </style> </head> <body> <p class="my-class">This text will be red colored</p> </body> </html>
25th Mar 2021, 9:32 AM
Nazeekk
Nazeekk - avatar
+ 1
In <head> tag of html you have to link "css" file using <link rel="stylesheet" href="yourcss.css"> In html you can add classes and IDs to every component if you need. In css you can get access to them by "." for classes and "#" for IDs
25th Mar 2021, 9:29 AM
Nazeekk
Nazeekk - avatar