Wed, 2011-12-28 20:00
I Have this code:
Html:
<div id="blauwbox"> </div> <div id="containertitel"> <<div id="titeldiv"> <h1>Dog Blog Of Tomieasdfasdf</h1> </div> </div> <div id="roodbox"> </div>
And this CSS:
h1{ position:relative; top:40px; font-family:Arial, Helvetica, sans-serif; text-align:center; margin:10px; } #blauwbox{ position:absolute; left:50%; margin-left:-100px; background:#09C; width:200px; height:300px; } #titeldiv{ top:100px; background-color:#FFF; border: double #f6d101; border-width:8px; height:90px; -moz-border-radius: 19px; -webkit-border-radius: 19px; } #roodbox{ position:absolute; left:50%; top:70px; margin-left:-175px; background:#F00; width:350px; height:60px; }
Now my problem is that I want the titeldiv to be centered in the windows like the other DIV's. But it must stay centerd even the content will change. Like the titel (h1) will becaume "Dogblog of Tomie, Annie an Pepper."
I'm just a bigginer and can't find the solution.
Tue, 2012-02-21 10:46
#1
use this
use this code:
h1{ position:relative; top:40px; font-family:Arial, Helvetica, sans-serif; text-align:center; margin:10px; } #blauwbox{ position:absolute; left:50%; margin-left:-100px; background:#09C; width:200px; height:300px; } #titeldiv{ top:100px; background-color:#FFF; border: double #f6d101; border-width:8px; height:90px; -moz-border-radius: 19px; -webkit-border-radius: 19px; } #roodbox{ position:absolute; left:50%; top:70px; margin-left:-175px; background:#F00; width:350px; height:60px; }
html
<div id="blauwbox"> <div id="containertitel"> <div id="titeldiv"> <h1>Dog Blog Of Tomieasdfasdf</h1> </div> </div> <div id="roodbox"> </div> </div>