2 replies [Last post]
Chimie
Offline
newbie
Last seen: 5 years 32 weeks ago
Timezone: GMT+2
Joined: 2014-08-23
Posts: 2
Points: 3

Hi, I am very new in css, and I don't know very much.

I want to make for first something like this :

Image

but I don't know how to make the page a half a color ( red ) and a half other ( white ).

This is my html:
HTML
And this is css:
CSS

Can someone help me to understand better? Thanks.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 1 day ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Hi Chimie,Here's one way to

Hi Chimie,
Here's one way to do it.

<!doctype html>
<html>
<head>
<style type="text/css">
body{
  background:white;
}
.background-red{
  background-color:red;
   position:absolute;
   top:0;
   left:0;
   height:50%;
  width:100%;
  z-index:-1;
}
 </style>
</head>
<body>
  <div class="background-red"></div>
  <p>Other stuff</p>
</body>
</html>

Chimie
Offline
newbie
Last seen: 5 years 32 weeks ago
Timezone: GMT+2
Joined: 2014-08-23
Posts: 2
Points: 3

Thank you so much.

Thank you so much.

Edit:

Now I have another problem, made it but when i try to put the image and text in middle of the red box, it's just in center, on top not in middle.

is like this:

________
text

________

but i want to be like this

_________

text <- in middle of box

_________