Previous Message
Next Message

Making a div with relative width?

Sent by Asle Ommundsen on 28 April 2006 09:09


First, her is the code:

HTML:

<div class="attribution">
<p>Hjelp til å bygge den største katalogen på nettet redigert av  
mennesker.</p>
<p class="attribution">
<a href="#">Legg til et nettsted</a> -
<a href="#"><strong>Open Directory Project</strong></a> -
<a href="#">Bli en redaktør</a>
</p>
</div>

CSS:

..attribution {
width:32em;
padding:0;
color:#fff;
background:#360;
font-family:arial, helvetica, sans-serif;
text-align:center;
margin:0 auto;
font-size:94%;
}

..attribution p {
padding:0.3em 0 0 0;
margin:0;
color:#fff;
background:#360;
font-size:0.99em; /* Fix for Konqueror on Fedora */
}

p.attribution {
width:auto;
padding:0.2em 0 0.2em 0;
margin:0;
color:#00f;
background:#ccc;
border:3px solid #360;
font-size:94%; /* Fix for Konqueror on Fedora */
}

p.attribution a:link {color:#00f;}
p.attribution a:visited {color:#00f;}
p.attribution a:hover {
background:transparent;
text-decoration:underline;
}

A live example can bee seen at the bottom of the page on http://odp.no/

The problem is the 32em width on .attribution, it scales and works good  
with browsers on windows (Firefox, Opera, IE6 and IE7), but on Ubuntu i  
doesn't. The problem is that the following line of text wrap into two  
lines, and it should really all be on only one line:

<p>Hjelp til å bygge den største katalogen på nettet redigert av  
mennesker.</p>

I am trying to manage without using any width at all, beacause that would  
solve the problem ones and for all, but I don't know how to do it. Is it  
possible to make the width relative to the content of the div so I don't  
have to specify any width any more? That is what I want to do.

PS: Please don't comment my special use of font-size, this is due to  
problems I had on Fedora, and I will remove them all if I find a solution  
to my question.

Thanks!

-- 
Vennlig hilsen,
Asle Ommundsen
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: