Have the background stick to the text...

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

Have the background stick to the text...

Postby Sacapuss » Thu 28 Apr, 2005 11:20 pm

Hi !

I'd like to have the background stick to the text. How could i do ?

Thanx for your help !

<li style="background:pink;">A propos</li>
UserAgent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.2.1) Gecko/20030416
User avatar
Sacapuss
junior member
junior member
 
Posts: 12
Joined: Wed 23 Mar, 2005 12:40 am

Re: Have the background stick to the text...

Postby Antony » Thu 28 Apr, 2005 11:28 pm

Sacapuss wrote:Hi !

I'd like to have the background stick to the text. How could i do ?

Thanx for your help !

<li style="background:pink;">A propos</li>
What do you mean by "stick" to the text?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Sacapuss » Thu 28 Apr, 2005 11:57 pm

Thank you, Antony, for your answer !

By "stick" to the text, i mean surround the text nearly; not going to the border of the page.
UserAgent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.2.1) Gecko/20030416
User avatar
Sacapuss
junior member
junior member
 
Posts: 12
Joined: Wed 23 Mar, 2005 12:40 am

Postby Antony » Fri 29 Apr, 2005 12:26 am

Sacapuss wrote:By "stick" to the text, i mean surround the text nearly; not going to the border of the page.

Okay, you will need to use [tt]<DIV>[/tt] or [tt]<span>[/tt] tag.

Such as [tt]<DIV style="background-color: #ddd;">the text</DIV>[/tt]
Or better, specify the dimension of the element.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Sacapuss » Fri 29 Apr, 2005 12:36 am

Thank you, Antony, for your answer !

<li><span style="background-color: #ddd;">the text</span></li>

produces the effect i was looking for. But i'd prefer a css way, not an html one.
UserAgent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.2.1) Gecko/20030416
User avatar
Sacapuss
junior member
junior member
 
Posts: 12
Joined: Wed 23 Mar, 2005 12:40 am

Postby Antony » Fri 29 Apr, 2005 12:53 am

Sacapuss wrote:Thank you, Antony, for your answer !

<li><span style="background-color: #ddd;">the text</span></li>

produces the effect i was looking for. But i'd prefer a css way, not an html one.
I thought I gave you a CSS method.

You can take out the [tt]style="..."[/tt] and put them into a style sheet.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot], MSNbot Media, Yahoo [Bot]