• Supposing I want to add an image to a post and want it to align right. I then want toadd a border and to stop the text coming right up to it I also want to add padding.
    How do I do that?
    My code is:
    <img src=”https://www.XXXXX/wordpress/wp-images/XXXX.jpg&#8221; alt=”XXXXX” align=”right” border=”1px” padding=”5px”/>
    Everything works except the padding.
    Any ideas where I’m going wrong?
    And as someone new to CSS am I right in thinking that I could put a line of code in the style sheet that would give all images a border and padding without me having to specify it every time on a post?
    Thanks for any help.
    Geo

Viewing 4 replies - 1 through 4 (of 4 total)
  • Insert it into the CSS, rather than every image you put into each post. That way, if you want to change it later, you won’t have to go through tens (hundreds?) of posts to do so.
    https://css.maxdesign.com.au/floatutorial/
    – Bryan

    In your wp-layout.css:
    .post img {
    float: right;
    border: 1px solid;
    padding-left: 1em;
    }

    Thread Starter Anonymous

    Thanks to you both.
    lambic – your code worked a treat ??
    btvillarin – I’ll be reading your tutorials! ??
    Geo

    I don’t want to take credit for them – they’re not mine. But I hope you look into them so you can better create CSS selectors. You never know when you’ll want the picture on the right, left or center of your page! Best of luck, Geo!
    – Bryan

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘images and padding in posts’ is closed to new replies.