• How to center a absolute div? + Getting a div to reach the top and bottom 100%?
    4 replies, posted
I'm working on this website in media class, and so far it's going great, but I have a few questions. It's eastern now, so my teacher is unavailable. Could you guys help me with your expertise? [I]First question.[/I] I know how to center div tags by having the left and right margin set on auto, but that doesn't seem to do the trick on my absolute div on the bottom of my page. Here is the styling: [code]#static { position:absolute; width:1000px; background-color: #9F6; height: 78px; margin-right: auto; margin-left: auto; bottom: 10px;[/code] when using the above settings it just sits in the left. [I]Question numéro doe.[/I] I want a slight gradient to be in centre, so it makes the content easier to read. However, I can't find a way to get the div to reach out max to the top and bottom. Like so: [Img_thumb]http://img145.imageshack.us/img145/3937/hyeas.jpg[/Img_thumb] Any help regarding any of these questions would be great.
You can't have a margin on an absolute divider. You'd have to do something like: right: 50%; left: 50%; If you want the image to be the background of the page, set it as that. There's no reason to 'hack' a way for something to work when it already does: background-image: url('image/location.png'); background-position: center center; background-repeat: repeat-y;
I tried doing as you said but it's off-center :frown: [Img]http://img130.imageshack.us/img130/123/failurev.jpg[/Img]
I'd just cheat and put another div inside that div and centre the div inside [code] <div class="a_class_that_puts_me_at_the_bottom"> <div class="centre_me"> Stuff </div> </div> [/code]
Thanks a ton, Bugster. It worked.
Sorry, you need to Log In to post a reply to this thread.