Jump to content
Sign in to follow this  
PHPDevil

Issues with DIV

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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>

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...