Forums

Adding margins automatically with CSS (3 posts)

  1. detobey
    Member
    Posted 2 years ago #

    Hi all:

    What information do I add to my style sheet to always force the following with every photo inserted into a blogpost?

    margin-top: 2px; margin-bottom: 4px; margin-left: 10px; margin-right: 10px;

    I want those margins to hold true for every image I could ever insert into a blog. I don't want to have to enter them manually in every post. Can I default them via the style sheet?

    Thanks -- detobey

  2. AlethiaPak
    Member
    Posted 2 years ago #

    img{ margin:2px 10px 4px 10px;}

    img > for every image on your site
    { margin:2px 10px 4px 10px;} > top right bottom left

    note that you might want to find specific class that wrap or is applied to the image you want to work with then do
    .yourClass img { margin:2px 10px 4px 10px;}
    or
    img.yourClass { margin:2px 10px 4px 10px;}

    b/c if you use only
    img{ margin:2px 10px 4px 10px;}
    it will really margin out all image in your site.

  3. Peter Boosten
    Member
    Posted 2 years ago #

    The easiest way (but this is for ALL images - also the header if applicable) would be

    img {
      margin: 2px 10px 4px 10px;
    }

    or in short hand

    img {
      margin: 2px 10px 4px;
    }

    Peter

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.