I have 4 divs but want to center them (horizontally and vertically).
Not much to say here, apparently this is quite easy but I am new to CSS and don't really know what I'm doing. Code so far:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style>
body {
}
div {
background-color:#308DD4;
opacity:0.8;
color:white;
width:200px; /* Change to 200 ish */
height:auto;
line-height:150px;
margin:5px;
font-size:36pt;
font-family:sans-serif;
text-align:center;
float:left;
}
a {
display:none;
line-height:35pt;
color:white;
text-decoration:none;
font-size:20pt;
}
div:hover a {
display:block;
}
</style>
</head>
<body>
<div>
Test 1
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
</div>
<div style="background-color:#ff34b3">
Test 2
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
</div>
<div style="clear:both;background-color:#9344bb">
Test 3
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
</div>
<div style="background-color:#8dd430">
Test 4
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
<a href="http://www.example.com">Test</a>
</div>
</body>
</html>
ALSO BY THE WAY:
Does anyone know how to do this? I am trying to copy it as much as I can, but again I don't really know what I'm doing...
Thanks, Itechmatrix