All,
This is my first post - ever.
I'm a beginner. My question is fairly simple ... I'm trying to align the text that is the the blue element (div 3) so that its centered both horizontally and vertically.
I accomplish the horizontally by using, text-align: center - - but how do I center it vertically??
Much appreciated!
John
HTML CODE:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<Title>Color Blocks</title>
<link rel="stylesheet" type="text/css" href="colors_rel.css" />
</head>
<body>
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
<div class="four">Four</div>
</body>
------------------------------
CSS CODE:
div {
position: relative;
width: 250px;
height: 100px;
border; 10px single black;
color: black;
}
div.one {
background-color: greenyellow;
padding-left: 180px;
padding-right: 80px;
padding-top: 80px;
}
div.two {
background-color: green;
}
div.three {
position: absolute;
background-color: blue;
right: 1200px;
top: 120px;
z-index: 4;
border-style: solid;
border-width: thick;
text-align: center;
}
div.four {
background-color: yellow;
text-align: right;
}