PHPDevil Posted August 11, 2012 Posted August 11, 2012 Hey guys i'm having a problem with some of my positioning. I've made a container for my web design to go into using a div and the code for it is. div.centered{ text-align: left; margin: 0 auto; width: 800px; border: 1px solid white; } now ive placed a banner in the div tag. <div class="centered"> <div class="banner"> <img src="logo.png" /> </div> </div> for me to position the image where i wanted i made another class however there is a issue with it working though. the code which i have at the momment is. div.banner { top:35px; } that doesn't do anything to the image. So i added in position:absolute; that does change the image to where i want it however it takes the image outside the DIV container where as i want it to stay there. Any suggestions on what to do? Thanks Quote
rulerofzu Posted August 11, 2012 Posted August 11, 2012 Position absolute will anchor to the proceeding parent. You should therefore use position relative on the div before so that it anchors to that div. Quote
Spudinski Posted August 11, 2012 Posted August 11, 2012 This article might be a bit dated, but still worth the read. It explains CSS precedence, the fancy word for what this issue is about. http://www.blooberry.com/indexdot/css/topics/cascade.htm Quote
PHPDevil Posted August 12, 2012 Author Posted August 12, 2012 thanks for your replies! I didn't get any luck with the changes :( the new codes allowed it to be in the div but prevented the height from changing Quote
semaphore.v Posted March 13, 2013 Posted March 13, 2013 The <div> tag defines a division or a section in an HTML document. The <div> tag is used to group block-elements to format them with CSS. <div style="color:#0000FF"> <h3>This is a heading</h3> <p>This is a paragraph.</p> </div> Quote
Dave Posted March 13, 2013 Posted March 13, 2013 The <div> tag defines a division or a section in an HTML document. The <div> tag is used to group block-elements to format them with CSS. <div style="color:#0000FF"> <h3>This is a heading</h3> <p>This is a paragraph.</p> </div> This is a pretty dated post you've brought back up. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.