Jump to content

Recommended Posts

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; }

Link to comment
https://forums.phpfreaks.com/topic/237925-image-padding-and-alignment-with-css/
Share on other sites

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.

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. ;)

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.