Jump to content

Whats the right size of the images


mjahkoh

Recommended Posts

Very grey i am in css.

 

I have a div which the following parameters.  i want a header to be of the same size but it wont. please help

 

Header - has logo plus banner (225+728)=953

 

div properties

margin left 4

Padding left 37

width         904

 

 

What should be the cummulative total of header images so they can match

 

 

Link to comment
Share on other sites

mjakoh the css boxmodel is something you must have a look at.

1)If the image is set as a background image you can use padding on top of the normal width and height of the div.

the total width+padding of your div should than be 953

 

 

2)If the images are elements inside of the div only the height and width of the div count. Besides that depending on if you used a newline for each image you may even want to add a float on the images, and that brings some other difficulties with it.

the total width of your div should than be 953 (without the padding)

 

see the example below and notice the images are on the same line.

 

<html>
<head>
<style type="text/css">
#header{
    width:953px;
    margin-left: 4px;
    padding-left:37px;
    border:3px solid red;
    }
#header img{background:green;height:100px;} /* just don this because i wanted to show a color since the src is empty */
</style>
</head>
<body>
    <div id="header">
        <img width="225" src="" alt="" /><img width="728" src="" alt="" />
    </div>
</body>
</html>

Link to comment
Share on other sites

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.