Solved

how to control distance with CSS in span tag

Posted on 2006-06-22
3
1,225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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 …
Suggested Courses

632 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