Solved

how to control distance with CSS in span tag

Posted on 2006-06-22
3
1,221 Views
Last Modified: 2011-09-20
hello, I made up a span tag to make image links in a row. But I cannot control distance between a image and another image. Please advise me how to control with CSS. browsing enviroment I.E and FireFox

++main.html++
<table width="600">
<tr>
<td>
<span class="footer_img1">
<a href="a.html"><img src="a.jpg" border="0"><a>
<!-- I'd like to change the distance here-->
<a href="b.html"><img src="b.jpg" border="0"><a>
<!-- I'd like to change the distance here-->
<a href="c.html"><img src="c.jpg" border="0"><a>
<!-- I'd like to change the distance here-->
<a href="d.html"><img src="d.jpg" border="0"><a>
<!-- I'd like to change the distance here-->
<a href="e.html"><img src="e.jpg" border="0"><a>
</span>
</td>
</tr>
</table>

++detail.css++
CSS code belows

.footer_img1 {
      margin-left: 11px;
      height: 20px;
      width: 143px;
}

B.W, portal123
0
Comment
Question by:portal123
3 Comments
 
LVL 8

Assisted Solution

by:KennyTM
KennyTM earned 250 total points
ID: 16958601
Set padding: or margin: on the <img>'s.
0
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 250 total points
ID: 16958738
width and height do not apply to non-replaced inline elements.
so, you'll need to set them on the images (also use CSS to specify the border):

span.footer_img1 img {
     height: 20px;
     width: 143px;
     border: none;
}

then you can use a margin on the <a>'s to control the spacing, but you'll have some additional space between the <a>'s due to the space-characters that separate them (space character = white space, tab, new line, line feed).
you can hide those space if you want using some class.
also, the WCAG says you sould separate your linhks by at least one non-space-character.
you can kill two birds with one stone, using this technique:

<span class="footer_img1">
<a href="a.html"><img src="a.jpg"></a><span class="spacer"> |
</span><a href="b.html"><img src="b.jpg"></a><span class="spacer"> |
</span><a href="c.html"><img src="c.jpg"></a><span class="spacer"> |
</span><a href="d.html"><img src="d.jpg"></a><span class="spacer"> |
</span><a href="e.html"><img src="e.jpg"></a>
</span>

span.footer_img1 span.spacer {
     display: none;
}

span.footer_img1 a {
     margin-left: 11px;
}
0
 

Author Comment

by:portal123
ID: 16958858
Both Works, Thanks a lot  => A++;

~~~~~ portal123 ~~~~~~
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question