/    Sign up×
Community /Pin to ProfileBookmark

spacing between images

Hi,

I’ve got several thumbnails next to each other. What code do I need to use to manage te spacing between the thumbnails?

Cheers,
Pieter

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJul 04.2004 — You could try the CSS margin attribute


<img src="image.jpg" width="50" height="50" style="margin:5px">

or for individual sides any one of the following

margin-top

margin-right

margin-bottom

margin-left
Copy linkTweet thisAlerts:
@johndoe190Jul 04.2004 — Yes but please use CSS more to control presentational features like width,height etc becuase they are depreciated attributes.
Copy linkTweet thisAlerts:
@Ben_RogersJul 04.2004 — <offtopic>

No, width and height for the <img /> attribute are fine, Sharkey, seeing as <img /> is presentational markup as it is- just with no substitute unless you use the Shea Image Replacement (or another method) like so:<i>
</i>#flag {width: 88px; height: 31px; overflow: hidden; position: relative;}
#flag span {position: absolute; height: 100%; width: 100%; background: url(images/flag.gif) no-repeat);}
...
&lt;p id="flag"&gt;&lt;span&gt;&lt;/span&gt;A flag!!! W007!&lt;/p&gt;
But that's too much work, the <img /> tag _is_ an image, even if images are presentational... I'm rambling now, so I'll just close with reminding everyone that's IMO, and that it _is_ debatable, but this isn't the thread to discuss it.

</offtopic>

Mr. J's right, and you could also do it the following ways:

margin: x y; where x is the top and bottom margins and y is the left and right margins, and also

margin: x y z n; where x is the top margin, y is the right margin, z is the bottom margin, and n is the left margin.
Copy linkTweet thisAlerts:
@philawebJul 05.2004 — [i]Originally posted by Mr J [/i]

[B]<img src="image.jpg" width="50" height="50" style="margin:5px">[/B][/QUOTE]


Why not make standalone style codes pure?

Like this:

[CODE]<img src=image.jpg" style="margin:5px;height:50px;width:50px" />[/CODE]
Copy linkTweet thisAlerts:
@Paul_JrJul 05.2004 — [i]Originally posted by sharkey [/i]

[B]Yes but please use CSS more to control presentational features like width,height etc becuase they are depreciated attributes. [/B][/QUOTE]

The height and width attributes are deprecated only for the <table> element &#8212; they are perfectly valid for images.
[I]Originally posted by Omega[/i]

[b]

<i>
</i>#flag {width: 88px; height: 31px; overflow: hidden; position: relative;}
#flag span {position: absolute; height: 100%; width: 100%; background: url(images/flag.gif) no-repeat);}
...
&lt;p id="flag"&gt;&lt;span&gt;&lt;/span&gt;A flag!!! W007!&lt;/p&gt;
[/B][/QUOTE]

That, in my opinion, is overly complex &#8212; this would do just fine
<i>
</i>div#container {
height: 75px;
width: 200px;
background: #FFF url(images/background.jpg) no-repeat left center;
}
div#container span {
display: none;
}
... ... ...
&lt;div id="container"&gt;&lt;span&gt;This text won't be seen, but the image will be&lt;/span&gt;&lt;/div&gt;


[i]Originally posted by philaweb [/i]

[B]Why not make standalone style codes pure?



Like this:



[CODE]<img src=image.jpg" style="margin:5px;height:50px;width:50px" />[/CODE] [/B][/QUOTE]

Not defining the dimensions of an image can cause the page to load slower (or so I've heard...), and you might see things shift around when the image starts loading and shoves everything aside so it can fit.

I would say those thumbnails are a list of images, and therefore should be marked up as a list. Vladdy has a great example located <[url=http://www.vladdy.net/Demos/Gallery.html]here[/url]>
Copy linkTweet thisAlerts:
@pieterhauthorJul 05.2004 — Hi,

Thanks for the many replies! Right now I am using MR J's advice, but will most likely go for Vladdy's set up (thanks Paul Jr!).

I posted another thread:

[URL=http://www.webdeveloper.com/forum/showthread.php?s=&threadid=38827]underline images on mouse over[/URL]

Cheers,

Pieter
×

Success!

Help @pieterh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...