View Full Version : HTML: 2 pics side by side
Lamer question here. I want to put 2 pics side by side on my web page but can't for the life of me remember how to do it. They just appearone above the other at separate sides of the page.
<IMG SRC='1.gif'>
<IMG SRC='2.gif'>
Genius. What about a small gap inbetween the pics?
<TABLE>
<TR>
<TD ><IMG SRC='1.gif'></TD>
<TD><IMG SRC='1.gif'></TD>
</TR>
</TABLE>
Don't forget t' <close /> them img tags :D
woopsy :D yes close them i forgot :rolleyes:
shifty.ricky
03-11-2003, 00:31
Easier to do..
<img src="img1.gif" align="left"></img>
<img src="img2.gif" align="right"></img>
How is it easier to close it with </img> rather than the (W3 approved) method of /> ? :confused:
ling_thing
03-11-2003, 00:55
Originally posted by Splaty
Don't forget t' <close /> them img tags :D
eh?
the img element does not require a closing tag
its just <img src="img1.gif">
but to be more forward thinking as we move towards tighter standards (i.e. xhtml, xml) its best to do the following...
1, close all tags even those that do not formally require it e.g. <br> => <br /> or <img> => <img />
2, all parameters of tags should be in lowercase and the values surrounded by double or single quotes e.g.
<table WIDTH=700> => <table width="700">
3, any options that do not require a value should still be set as such e.g.
<frame name="blah" noscroll> => <frame name="blah" noscroll="noscroll">
coding this way helps a long way to keeping it compatible with future definitions and means that if you do want to move to xml in the future the hard part is already done for you.
Originally posted by shifty.ricky
Easier to do..
<img src="img1.gif" align="left"></img>
<img src="img2.gif" align="right"></img>
I dont see how thats easier than />.
Closing image tags etc is not mandatory for html. but its a god idea if you ever want to move onto xml and the likes.
But if your just learning HTML and cant were bothered to then you don’t need to.
Img's also need an alt tag to pass validation...
<img src="test.gif" width="150" height="150" alt="My Image"/>
if you dont want an alt tag then you still have to include the paramater, just leave it empty:
<img src="test.gif" width="150" height="150" alt=""/>
To the ordinary joe this does exactly the same as:
<img src=test.gif width=150 height=150>
I'm not 100% sure about these new standards as there not going to drop the old ones - so people will always produce old HTML code.
If you want an even simpler way of positioning your images with a gap (and arent fussed with XHTML) use:
<img src='1.gif'>&nbsp;<img src='2.gif'>
shifty.ricky
05-11-2003, 00:42
Originally posted by Splaty
How is it easier to close it with </img> rather than the (W3 approved) method of /> ? :confused:
I was talking about doing that instead of doing a table for the images.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.