hullcalendar Posted May 30, 2011 Share Posted May 30, 2011 two things im stuck on guys, im just wondering what the CSS would be for image padding (vspace and hspace)? i also want to align my text into the center of my images, how would i do this vis CSS? i picked this code up but it not having any effect at the moment. { vertical-align:text-middle; img { margin: 3px 3px; } Quote Link to comment https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/ Share on other sites More sharing options...
cssfreakie Posted May 30, 2011 Share Posted May 30, 2011 just as a side note i assume you also moved the <link into the <head> section? There is a reason I mentioned that in the last post. Now back to this question padding is declared clockwise starting at the top. so img{ padding: 1px 2px 3px 4px; } would give this image a padding top of 1pixel, a padding right of 2 pixels, a padding bottom of 3 pixels and a padding left of 4 pixels. You might want to google for css box-model. even better get a nice book on the subject. (books are worth there weight in gold). If you want to move text in the middle of an image, they need to be overlapping each other. (they need other dimensions) I recommend you first have a look in to the properties position:relative; and position:absolute; ones you provided some code that showed you can apply just some text overlapping the image i am happy to provide the solution how to center it. (because that is a bit tricky) for now, i recommend you learn some css basics. A nice tutorial can be found here: http://bayarearcsociety.com/tutorial/css_tutorial1.php It wont take you long to finish it, but if you don't like books that is okay enough as a starter. It's made by another phpfreak user (crmamx) that learned css just 6 months ago. Quote Link to comment https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/#findComment-1222615 Share on other sites More sharing options...
hullcalendar Posted May 30, 2011 Author Share Posted May 30, 2011 thanks for the help im looking at some books on amazon and ebay at the moment so should have some soon so wont have to ask such newbie questions, but until then ill take a look at that tutorial, thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/#findComment-1222617 Share on other sites More sharing options...
cssfreakie Posted May 30, 2011 Share Posted May 30, 2011 css is not as complex as a php or javascript. but there are some best practises and a few concepts you should know. so do that tutorial and read the sticky above this thread, and you will be fine. And trust me i am happy to provide help. But it''s even more fun if you in the end know how to do it and can help others around here or else. that's the idea of the forum, learn and help. Quote Link to comment https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/#findComment-1222620 Share on other sites More sharing options...
crmamx Posted May 31, 2011 Share Posted May 31, 2011 cssfreakie.... i am happy to provide the solution how to center it. (because that is a bit tricky) It isn't tricky if you use monkeys. Quote Link to comment https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/#findComment-1222713 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.