<head style="background-color:blue; padding:10px;">

I want background-color of <head> element is blue. I tried
<head style="background-color:blue; padding:10px">
Is İt possible?

<!DOCTYPE html>
<html style="background-color:pink;">
<head style="background-color:blue; padding:10px;">
<style type="text/css" style="background-color:red; padding:10px;">


<script type="text/javascript" style="background-color:red; padding:10px;">

<body style="background-color:purple; padding:10px;">

<h1 style="background-color:magenta;">JavaScript Statements</h1>
<p style="background-color:orange;padding:10px;">Statements are separated by <span style="background-color:red;">semicolons.</span></p>


You need to apply it to <body> not <head>

The <head> element in html should not be visible in the browser, therefore you should not style it.
The head is to give information to the browser, it’s not for viewing.
Possibly you are confusing it with a header element.



Here you go :slight_smile:

head, head *{display:block;background:blue}

Sorry couldn’t resist it.:wink:


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.