HTML Image Alignment

R

RigasMinho

Hello,
I have this issue where somehow i want the first image to be placed all
the way on the left part of the screen.

While the 2nd image has to be placed a little bit to the right side of
the left margin.

I cant seem to get it to work:
<body style="margin-left:50;margin-right=50" >
<img src="test.GIF" />
<img src="test2.jpg" />

If i change teh body style to "margin-left:0;
then it aligns both pictures to the left.

I only want the first picture aligned to the left but cant get the
second picture to align someplace else.

Any ideas?
 
J

Jonathan N. Little

RigasMinho said:
Hello,
I have this issue where somehow i want the first image to be placed all
the way on the left part of the screen.

While the 2nd image has to be placed a little bit to the right side of
the left margin.

I cant seem to get it to work:
<body style="margin-left:50;margin-right=50" >
#1 50 what? With CSS you must specify the *units* for most lengths, 50px
a assume?
<img src="test.GIF" />
<img src="test2.jpg" />

#2 images are inline not block element by default so by your markup
test2.jpg would follow to the right of test.GIF

If i change teh body style to "margin-left:0;
then it aligns both pictures to the left.

I only want the first picture aligned to the left but cant get the
second picture to align someplace else.

Yes, give it a different style, In HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/stylesheet">
BODY { margin: 0 50px; }
.hugLeft { margin-left: -50px; }
.offsetLeft { margin-left: 20px; }
</style>
</head>
<body>
<div class="hugLeft">
<img src="text.GIF" alt="test1">
Should hug the left side of window
</div>
<div class="hugLeft">
<img src="text2.jpg" alt="test2">
Should be 70px offset from side of window
</div>
<p>
Standard 50px margin for page....
</p>
</body>
</html>
 
D

dorayme

"RigasMinho said:
Hello,
I have this issue where somehow i want the first image to be placed all
the way on the left part of the screen.

While the 2nd image has to be placed a little bit to the right side of
the left margin.

I cant seem to get it to work:
<body style="margin-left:50;margin-right=50" >
<img src="test.GIF" />
<img src="test2.jpg" />

If i change teh body style to "margin-left:0;
then it aligns both pictures to the left.

I only want the first picture aligned to the left but cant get the
second picture to align someplace else.

Any ideas?

Is this no good?

<div>
<img src="unknown.gif" alt="test1">
Should hug the left side of window
</div>
<div style="margin-left:70px;">
<img src="unknown.gif" alt="test2">
Should be 70px offset from side of window
</div>
 
R

RigasMinho

Dorayme - your solution works thanks.

I actually figured it out before your post but i appreciate your help.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top