Newbie CSS question - IMG

J

Jack

I've messed with this for hours refering to tutorials and specs to no avail.

I want to have images flush left (or flush right) with the text running
around and I can do this with HTML. But I want to do it CORRECTLY so I'm
trying to create 2 classes img.left and img.right

CSS
img {
/* turns off gaps around images */
border: 0;
}
img.left {
align: left;
hspace: 20;
}

HTML
<img class=left
alt="Photo of Portland Head Light" src="lighthouse.jpeg"
height="256" width="384"/>

It seems that the 'class= left' is being ignored.

Any help is appreciated, TIA
Jack
 
S

Steve Pugh

Jack said:
I've messed with this for hours refering to tutorials and specs to no avail.

I want to have images flush left (or flush right) with the text running
around and I can do this with HTML. But I want to do it CORRECTLY so I'm
trying to create 2 classes img.left and img.right

CSS
img {
/* turns off gaps around images */
border: 0;
}

No, it sets the border of the image to zero. To remove any 'gaps'
around the image set margin :0;
img.left {
align: left;
hspace: 20;
}

There's no CSS property called align.
You want float: left;

There's no CSS property called hspace.
Even if there was all non-zero lengths in CSS must have units.
I think you want margin: 0 20px; to set zero top and bottom margins
and 20px left and right margins.
HTML
<img class=left
alt="Photo of Portland Head Light" src="lighthouse.jpeg"
height="256" width="384"/>

It seems that the 'class= left' is being ignored.

Well as there are no actual style properties defined for left there's
nothing to ignore.
Any help is appreciated, TIA

Read the CSS specification it's a lot quicker and more efficient than
trial and error guessing of what CSS properties might exist. .

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top