Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

positioning text

Status
Not open for further replies.

dijo123

Programmer
Jan 13, 2004
30
SE
Hello,

I would like to have something that has the width: 10px, to place in front of a text.
Explanation:
I have an image followed by a text like this:
Code:
<img src="a.png" id="a1">&nbsp;
<a href="#" onclick="link(); return false" class="cl1">Hello!</a><br>
	
<img src="no.png" id="a2">&nbsp;
<a href="#" onclick="sm(); return false" class="cl2">Hello again!</a><br>
In the first and second line, I have an image followed by the text "Hello"(in this example). 4th and 5th line: I have an empty image and then the text "Hello again!". The text "Hello again!" has the same text indentation as the text above.
The problem is: I do not want an empty image, but if I remove the image, the text indentation becomes wrong. I tried to fill out with empty spaces (many &nbps), but it did not work. I do not want anything inside the <a>-tag, I want something in front of it.

I also tried to make a new tag, called noimg, with width= 10px. It worked if I put a letter inside that tag, otherwise not.

please help!

 
Code:
<span style="padding:50px;">Hello</span>
[code]

The above should do what you need.  Just replace 50px with what ever indentation you require.

The padding attribute adds the indentation inside the span tag, so if you had a blue background colour, it would show for 50px before the text as well as behind the text.

If you do not want this, use margin instead of padding.

Dan

Dan Morgan - [URL unfurl="true"]www.ski-review.com[/URL]
 

Hi Dan...

Just wondering if you're the same Dan Morgan I worked with at ICL Sorbus on the Escom helpdesk all those years ago?

Dan
 
Just a note if you only want to indent on the left you can use margin-left or padding-left insted of margin or padding which will leave space all the way around the text.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top