Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

How to set the total width of an element ?
 

Timothy Madden




quote this post edit post

IP Loged report this post

Old Post  07-18-04 - 12:16 AM  
Hello

Is it possible with CSS to have a DIV for wich the total (content-width +
padding + border) to be say 150px and for wich to have a 2ex padding and a
1px border ?

I need this since I have a background image wich is not a repeating pattern
so my DIV must be exaclty as wide as the image, including padding and
borders.

--
Thank you
Timothy Madden
Romania
---------------------------
And I don't wanna miss a thing


Post Follow-Up to this message ]
Re: How to set the total width of an element ?
 

Brian




quote this post edit post

IP Loged report this post

Old Post  07-18-04 - 12:16 AM  
Timothy Madden wrote:

> Is it possible with CSS to have a DIV for wich the total (content-width +
> padding + border) to be say 150px and for wich to have a 2ex padding and a
> 1px border ?

Yes, if you don't mind a tad of div soup:

<DIV CLASS="foo">
<DIV>
here's my text, behind which will be a nifty
background-image that will not repeat
</DIV>
</DIV>


DIV.foo {
width: 150px; /* warning: fixed width for text container! */
}

DIV.foo DIV {
border: 1px solid #808080;
padding: 2ex;
}

Tested in Firefox. Should work elsewhere, but who knows with MSIE/Win?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/


Post Follow-Up to this message ]
Re: How to set the total width of an element ?
 

Timothy Madden




quote this post edit post

IP Loged report this post

Old Post  07-18-04 - 04:15 AM  
Brian wrote:

> Timothy Madden wrote:
> 
>
> Yes, if you don't mind a tad of div soup:
>
> <DIV CLASS="foo">
>    <DIV>
>      here's my text, behind which will be a nifty
>      background-image that will not repeat
>    </DIV>
> </DIV>
>
>
> DIV.foo {
>    width: 150px; /* warning: fixed width for text container! */
> }
>
> DIV.foo DIV {
>    border: 1px solid #808080;
>    padding: 2ex;
> }
>
> Tested in Firefox. Should work elsewhere, but who knows with MSIE/Win?

Thank you. I see now. Indeed it is possible.
I needed this several times and never thought about it this way ...
--
Timothy Madden
Romania
-------------------------
And I don't wanna miss a thing


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 04:12 AM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top