[thelist] Shrink wrapping a div?

Christopher Mahan chris_mahan at yahoo.com
Thu May 13 16:23:36 CDT 2004


--- Maximillian Schwanekamp <anaxamaxan at neptunewebworks.com> wrote:
> --------------------------
> I.e. If I put Xpx-wide element inside the div, I want the
> > div to
> > be Xpx wide (plus padding and border), not 100% of the content
> > width for its
> > parent.
> 
> .somediv{display: inline}
> --------------------------
> 
> Thanks, but as always I should have phrased the question better. 
> Using
> display: inline; sorta works, but not quite.  I am wanting to
> center a div
> of arbitrary width (depending on dynamic content), and give it a
> border that
> just frames the content.  Doing this with a fixed-width div is no
> problem,
> but I am trying to style for a div of unknown precise width.
> 
> In days of yore, I would wrap a table around the content, give it
> align="center" and call it a day.  Well, for the border, there
> would be
> another table framing the first, but we won't talk further about
> nested
> tables in mixed company.  Anyway, I am sure I am just missing
> something
> here.

<div class="a">
  <div class="b">
    <p>Some text</p>
  </div>
</div>

.a{
  text-align:center;
  }
.b{
  display: inline;
  border: 1px solid #ff0000 
  }


=====
Christopher Mahan
chris_mahan at yahoo.com
818.943.1850 cell
http://www.christophermahan.com/


	
		
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861 


More information about the thelist mailing list