Solved

Image Padding

Posted on 2004-11-01
16,147 Views
Last Modified: 2011-08-18
How do I add padding to an image so that it is on 2 sides only so that text is kept away from the right and botton sides of the image.

So maybe something like this:-

.p2 { padding:0em 3em 3em 0em}

Jezella
0
Question by:jezella
    7 Comments
     
    LVL 53

    Expert Comment

    by:COBOLdinosaur
    Just put the image in a span using that class:

    <span class="p2"><img src="yourimage.jpg"></span>

    The span will size to the image plus the padding.

    Cd&
    0
     

    Author Comment

    by:jezella
    This does not appear to work as I had hoped as I loose the test to the right.

    This is an example http://www.ashley-wedding-cars.co.uk/examples/about-us.htm where I want to maintain the general layout but increase the space between the master image (the one with the question mark) and the text to the right of the image.

    What CSS would I need to write to achieve this@

    Many thanks

    Jezella
    0
     
    LVL 31

    Accepted Solution

    by:
    Hi Jezella,

    This is the basic format:

    <p><img style="float:left; margin:0 3em 3em 0; border:none;" src="" width="500" height="256">Text</p>

    (Don't use align="left" or hspace...)

    Sean
    0
     

    Author Comment

    by:jezella
    That's much better Sean, page lookes better and with more control. Thank you and also to Cd&

    Jezella
    0
     
    LVL 31

    Expert Comment

    by:seanpowell
    My pleasure.
    I posted a response to your other FP Q a while ago, don't know if I'm too late or not...
    Sean
    0
     

    Author Comment

    by:jezella
    Sean in an external CSS, should the following work

    .top-left-image
          {
          float:left; margin:0 3em 3em 0; border:none;
          }


    That table sizing was a problem Sean.

    Jezella
    0
     
    LVL 31

    Expert Comment

    by:seanpowell
    It should...
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Shellfire Box VPN + Lifetime Subscription

    The Shellfire Box easily connects all of your devices, even those that don't offer the possibility to establish a safe vpn connection. Access blocked content and surf safely, no matter where in the world you are located.

    Most web designers often experience crossbrowser issues during interface design / development.  On common problem is with Internet Explorer due to its rendering discrepancies between previous versions.  Here are some techniques I use to help avoid c…
    This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
    In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
    In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now