생활
can i include CSS in a HTML document without creating a .css file?
Can I include CSS in a HTML document without creating a .css file?
is it possible?
2개의 답변이 있어요!
Sure you can!
<html> <head> <title>bla bla bla ~</title> <link rel="stylesheet" href="(path of file below)" /> </head> <body> <p>Hello World!</p> </body> </html>body { background: #000000; } h1 { color: #FFFFFF; }Separating css file is good habit. but if you really really hate to separate into multiple files...
<html> <head> <title>bla bla bla ~</title> <style> body { background: #000000; } h1 { color: #FFFFFF; } </style> </head> <body> <p>Hello World!</p> </body> </html>You can combine it using style tag, but not recommended.
Yes, it's possible!
Example 1)
<!DOCTYPE html> <html> <body> <h1 style="background-color:Red;">Red</h1> <h1 style="background-color:Green;">Green</h1> <h1 style="background-color:Blue;">Blue</h1> </body> </html>Example 2)
<!DOCTYPE html> <html> <head> <style> h1 {color:red;} p {color:blue;} </style> </head> <body> <h1> 제목입니다 / headline color is red</h1> <p> 글자가 파란색으로 나와요 / text color is blue</p> </body> </html>