How to write style code in the head section?

LAST READ: APR 20 2024 | Q. BY: RIDHA ZHARFAN

V

Vivek

Style Code in <head> Section

To include style code in the <head> section of an HTML document, you can use the <style> tag and define all CSS codes within the <style> open and close tags, for example:


Syntax Example to Write CSS Code in <head> Section

<!DOCTYPE html>

<html>

<head>

  <title>First Web Page</title>

  <style>

    body { font-family: Arial, sans-serif; background-color: #f0f0f0; color: #333; }

    h1 { color: #0066cc; }

  </style>

</head>


<body>

  <h1>Hello, World!</h1>

</body>

</html>

1 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)