Jump to content

Help with align with in DIV


Trium918

Recommended Posts

I am trying to get an an image to center
with a <div> tag. 

The image is attached below.

Here is the entire code!
<style type="text/css">
HTML #member {
HEIGHT: 1%
}
#member{
background-color:#f7f7f7;
display:block;
width:530px;
border-bottom: #0273AD 1px solid;
border-left: #0273AD 1px solid;
border-right: #0273AD 1px solid;
border-top: #0273AD 1px solid;
padding: 5px;

}
#member_content{ 
background-color:#000000;
width: 362px;
float:right;
} 
#member_image{
background-color:#000000;
width: 160px;
height: 150px;
float:left;
VERTICAL-ALIGN: top; 
TEXT-ALIGN: left
}
</style>

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/53101-help-with-align-with-in-div/
Share on other sites

First, "VERTICAL-ALIGN: top;" is not a valid css command.

 

Second, where are you trying to center the image?

 

In "#member" or in "#member_content?

 

If within #member_content

 

try this:

 

#member_content{

background-color:#000000;

width: 362px;

float:right;

 

#member_content img {

width: 160px;

height: 150px;

margin-right: auto;

margin-left: auto;

 

}

 

(or use the short-hand for the above 2 margin commands - margin: 0 auto;)

 

Remember, the cascading order for padding, margin, is always "top, right, bottom, left".

 

And your borders in #member, can simply be ... border: 1px solid #0273AD;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.