mjahkoh Posted August 8, 2011 Share Posted August 8, 2011 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 Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted August 8, 2011 Share Posted August 8, 2011 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> Quote Link to comment Share on other sites More sharing options...
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.