Jump to content

I Can't Set the background Color Using HTML for the Whole page except I put a text for that!


Poryafm12

Recommended Posts

To Whom may concern,


I was making a background color for HTML using visual studio, I used this code for set the background color:

<html>
<head>
<title>Page Title</title>
</head>
<body style="background-color: aqua">
A text.
</body>
</html>

But When I saw the preview for that, It's just set the background text for TEXTS that typed in Body. I want to make it for the whole page. I already tried this code for set the background color:

<html>
<head>
<title>Page Title</title>
</head>
<body bgcolor="aqua">
A text.
</body>
</html>

 

Is there any way for me to do the whole page by a specific color?

Link to comment
Share on other sites

Hi there,

Welcome to the forums!

In the example you've placed here, the HTML document doesn't actually cover "the whole page" if you're referring to the browser window. The only part that fills up is the body.

You might be able to apply some combination of these styles so that it does fill in the browser window.

html {
   margin: 0px;
   height: 100%;
   width: 100%;
}

body {
   margin: 0px;
   min-height: 100%;
   width: 100%;
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...