Benches Apps and software

5

Help Needed with HTML code for Image Positioning

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi All,

Need a little help with some code for positioning images.

I initially used the following:

---

This is fine, but the border automatically puts a black border around the photo - how do I change it to white? Is there a way to set margins too, to prevent the text butting up against the photo?

I also used the following code with success:

<style type="text/css"
img
{
float:right;
border:2px solid white;
margin: 0px 0px 15px 20px
}
</style>

This code works, however the problem with it is it is not individual to just one photo - it moved all my photos and on that page, I wanted one photo floated to left and another to the right.

If I use this code, how can I make it photo specific, so that it only affects the placement, margins and borders of one photo?

Any help would be great.

Thanks

5 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The initial code that I used:

    ----

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    CSS question, not iWeb question. Regardless, use inline CSS styling for the image. You can also wrap the image in its own tag and declare an id or simply declare an id for the img tag, then set the style for the id_name:


    <style type="text/css"
    img#id_name
    {
    float:right;
    border:2px solid white;
    margin: 0px 0px 15px 20px
    }
    </style>

    If you want to control the style of more than one image on a page but not all then use a class instead of an id.

    the border automatically puts a black border around the photo - how do I change it to white? Is there a way to set margins too, to prevent the text butting up against the photo?

    I believe you have discovered a solution for this according to your CSS code. You have set the border to white by looking at the code and adjusting it appropriately. Your margin is declared in the CSS also, adjust the pixels appropriately.

    Read up some more on CSS to educate yourself further. I suggest w3schools.com or a CSS forum instead of the iWeb forum if you have CSS questions. It's kind of like if you drive your auto to the supermarket so you decide to go to the supermarket and ask everyone in the produce section to help when you have car problems. All the supermarket does is provide a place to park your auto. If you have car problems then ask a mechanic. iWeb (and most of its users) doesn't specialize in code, it simply provides an area for you to place it. Granted you might get lucky and find a mechanic in the produce section of the supermarket, but you're more likely to find a specialist at an auto swap meet (or CSS coding forum)!

  3. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Okay, so you can come down off your high horse now and yes, I am very well aware that this is html and css related. However, it is iWeb related because I use iWeb for my sites and have used iWeb for my sites for some time now.

    The reason I am asking is that I have used iWeb for the basic layout of the site and am typing my text etc directly into an html snippet so that I can have scrolling text boxes on my site - this is a way of making the site smaller and keeping the pages a uniform length and making the whole site look neater.

    Also, before I asked this question I had actually looked at 2 books on html and css and had looked at the w3schools website and could not find the exact answer that I was looking for - perhaps I was not asking the right question, but hence why I asked here.

    I think having 2 books on the subject and looking at the appropriate websites constitutes 'educating myself'!!

  4. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    However, it is iWeb related because I use iWeb for my sites

    Just because you paste it in the HTML Snippet doesn't mean it's iWeb related.

    Anything you paste in the HTL Snippet is your responsibility.

    iWeb does not care about your code and will happily publish it, whether it works or not.

    You mend it.

    Here are some pages you can practice with :

    http://www.wyodor.net/_Data/default.html
    http://www.wyodor.net/Centered/
    http://www.wyodor.net/hello_world/
    http://www.wyodor.net/boxsamples/

  5. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Yes, I realise this and that the snippet will publish anything. Actually, most of what I have placed in the snippet already is correct and works as expected. If not, I have found out the reason why with the use of books and the web and have corrected it in the snippet until it works.

    I have just done a test publish of my site to a folder from iWeb and it is looking good - it works as expected.

    I am getting lots of practice at the moment thanks!