<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;">

</style>

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

</script>
</head>
<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>

</body>
</html>

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.

2 Likes

Thanks

Here you go :slight_smile:

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

Sorry couldn’t resist it.:wink:

5 Likes

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