Solved

how to control distance with CSS in span tag

Posted on 2006-06-22
3
1,220 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…

776 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