Jump to content

Centering Image and Coloring Padding


Warptweet

Recommended Posts

I used this code to position my websites main banner:

 

<img style="position: absolute; top: 0px; left: 125px;" src="images/fpheader2.jpg" alt='Warptweet.com Home' border='0' />

 

I've tried many methods, but I can't seem to use the css involved with that image to center the image.

On my screen, it's centered perfectly fine. But on other screens, such as widescreens, flatscreens, screens of all sizes, it's totally abstract and I can't seem to find a way to center the image horizontally according to the users screen/browser.

 

Second Question:

 

I've tried many methods.. I'm sure this is simple, but how can I color the padding for a div I made? Sorry, I totally forget some css things.

 

Any help is appreciated! Thanks!

Link to comment
Share on other sites

You need to use {margin:0 auto} to center an element, but make sure the element is not positioned absolutely. It is much more tricky to center something that is absolutely positioned.

 

You can't color padding. You'll have to use colored backgrounds and borders...or maybe even use a positioned background image to "fake" it. Can't know what the most appropriate solution is without seeing what it's meant to look like.

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.