+ 2

How do you import CSS style into a HTML document? Do you create a CSS style separately and then link it to the document?

3rd Apr 2017, 10:11 AM
Harris Mulbah
Harris Mulbah - avatar
4 Answers
+ 3
separate css file is good practice, but you can include your css styling in the HTML file. Same goes for Java Script.
3rd Apr 2017, 10:13 AM
seamiki
seamiki - avatar
+ 3
create an external file with css extension in the same folder where your HTML file is located, then link the css to HTML in the head section as below: <link type="text/css" rel="stylesheet" href="mystylesheet.css>
3rd Apr 2017, 11:55 AM
Naeem Rind
Naeem Rind - avatar
+ 1
Thanks, Seamiki
3rd Apr 2017, 10:15 AM
Harris Mulbah
Harris Mulbah - avatar
0
There are some ways to use CSS: - Inline style sheets: a term that refers to style sheet information being applied to the current element: <p style="color: #ff9900"> -Embedded style sheets: refer to when you embed style sheet information into an HTML document using the <style>element.  <html> <head> <style type="text/css"> p { font-family: georgia, serif; font-size: x-large; color:#ff9900; } a:hover { color: LimeGreen; text-decoration: none; } </style> </head> ... - External style sheet: a separate file where you can declare all the styles that you want to use on your website. body { background-color: darkslategrey; color: azure; font-size: 1.1em; } h1 { color: coral; } #intro { font-size: 1.3em; } .colorful { color: orange; }
3rd Apr 2017, 10:16 AM
Felipe Cruz
Felipe Cruz - avatar