Jump to content

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;

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.