...

View Full Version : set box to width of text?



jarv
01-26-2012, 11:34 AM
hi, on my site in the header image I have a dark box around some text, this currently fills the width of the header image, is there any way of setting it to the width of the actual text width?

thanks

here is my site (http://www.aandheurope.com/index.php?PageID=1)

tracknut
01-26-2012, 04:25 PM
Are these the boxes you're referring to?


<div id="section-1" class="section section1">
<p>Jewellery Boxes</p>
</div>
<div id="section-2" class="section section2">
<p>Moulded tags and Hangers</p>
</div>


If so, rather than placing and styling a fixed size div around them, just style the background of the <p> as it will be whatever size the text is.

Dave

VIPStephan
01-27-2012, 08:39 AM
I would say display: inline-block is your choice.

jarv
01-27-2012, 07:52 PM
Hi, yes I am referring to:




<div id="section-1" class="section section1">
<p>Jewellery Boxes</p>
</div>
<div id="section-2" class="section section2">
<p>Moulded tags and Hangers</p>
</div>


I have styled the <p> tag and added display:inline-block;

still doesn't work?!

jarv
01-28-2012, 12:57 PM
Can anyone help me here please?

tracknut
01-28-2012, 03:52 PM
Tried yesterday, but I couldn't get to your server. The styles for both #content p and p have width:940px on them. So that's forcing the label across the entire header. Remove that fixed with, it should go back to just the size of the text.

Dave

nameno
01-28-2012, 04:03 PM
exactly ..i was just doing that ..remove the width:940 from the p and
#content p , and with the display:inline-block; under #container p ,you should have what you want

i`m a bit late i see:P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum