Warptweet Posted November 9, 2007 Share Posted November 9, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/76609-centering-image-and-coloring-padding/ Share on other sites More sharing options...
bronzemonkey Posted November 9, 2007 Share Posted November 9, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/76609-centering-image-and-coloring-padding/#findComment-388001 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.