Solved

how to control distance with CSS in span tag

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now