Connecting Tech Pros Worldwide Forums | Help | Site Map

Nested DIVs - is there a better way?

Guadala Harry
Guest
 
Posts: n/a
#1: Nov 18 '05
Please follow my thinking here and tell me if I'm nuts or if this is a
reasonable thing to do given the objective:

I'd like to present 3 data values on an aspx page - each styled uniquely,
and the total width to be limited to some arbitrary value (400px or so).

Given that I'd like to limit the total width, I can't use a <td> because the
width specified for a <td> specifies a minimum and not a maximum.
Consequently I'll use a DIV because I can specify a width that is the
maximum (anything exceeding that maximum will wrap automatically - which is
what I want).

That takes care of the overall width being limited. Now we still have to
style each of the 3 data values uniquely (will be using css - as in
class=x). The requirement to format each data value uniquely will be met by
placing each data value in its own DIV for which the css class is specified.

My concern is that this all results in three DIVs nested within another DIV
(the 3 for the data values and the "outer DIV" to limit the overall width).
Maybe this is a reasonable thing to do - maybe not.

FWIW: these nested DIVs would be located within a <TD> for general placement
on the page - as I'm using a table layout.

Is this a reasonable way to get the desired result or is there a better way?

Thanks!



Kevin Spencer
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Nested DIVs - is there a better way?


There's nothing wrong with what you're describing. However, I would like to
point out that a table doesn't have to stretch horizontally. It can wrap as
well, which results in stretching it vertically, just like a div. Of course,
with a div you can also add scroll bars, so it doesn't have to change size
at all.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Guadala Harry" <GMan@NoSpam.com> wrote in message
news:##9Dqm4uEHA.3828@TK2MSFTNGP12.phx.gbl...[color=blue]
> Please follow my thinking here and tell me if I'm nuts or if this is a
> reasonable thing to do given the objective:
>
> I'd like to present 3 data values on an aspx page - each styled uniquely,
> and the total width to be limited to some arbitrary value (400px or so).
>
> Given that I'd like to limit the total width, I can't use a <td> because[/color]
the[color=blue]
> width specified for a <td> specifies a minimum and not a maximum.
> Consequently I'll use a DIV because I can specify a width that is the
> maximum (anything exceeding that maximum will wrap automatically - which[/color]
is[color=blue]
> what I want).
>
> That takes care of the overall width being limited. Now we still have to
> style each of the 3 data values uniquely (will be using css - as in
> class=x). The requirement to format each data value uniquely will be met[/color]
by[color=blue]
> placing each data value in its own DIV for which the css class is[/color]
specified.[color=blue]
>
> My concern is that this all results in three DIVs nested within another[/color]
DIV[color=blue]
> (the 3 for the data values and the "outer DIV" to limit the overall[/color]
width).[color=blue]
> Maybe this is a reasonable thing to do - maybe not.
>
> FWIW: these nested DIVs would be located within a <TD> for general[/color]
placement[color=blue]
> on the page - as I'm using a table layout.
>
> Is this a reasonable way to get the desired result or is there a better[/color]
way?[color=blue]
>
> Thanks!
>
>[/color]


Guadala Harry
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Nested DIVs - is there a better way?


Thanks for the quick feedback and the clarification on <TD> width... just
tested and found my understanding to be incorrect as you pointed out.
Thanks.

-GH

"Kevin Spencer" <kspencer@takempis.com> wrote in message
news:e9O7wB5uEHA.3152@TK2MSFTNGP14.phx.gbl...[color=blue]
> There's nothing wrong with what you're describing. However, I would like[/color]
to[color=blue]
> point out that a table doesn't have to stretch horizontally. It can wrap[/color]
as[color=blue]
> well, which results in stretching it vertically, just like a div. Of[/color]
course,[color=blue]
> with a div you can also add scroll bars, so it doesn't have to change[/color]
size[color=blue]
> at all.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> I get paid good money to
> solve puzzles for a living
>
> "Guadala Harry" <GMan@NoSpam.com> wrote in message
> news:##9Dqm4uEHA.3828@TK2MSFTNGP12.phx.gbl...[color=green]
> > Please follow my thinking here and tell me if I'm nuts or if this is a
> > reasonable thing to do given the objective:
> >
> > I'd like to present 3 data values on an aspx page - each styled[/color][/color]
uniquely,[color=blue][color=green]
> > and the total width to be limited to some arbitrary value (400px or so).
> >
> > Given that I'd like to limit the total width, I can't use a <td> because[/color]
> the[color=green]
> > width specified for a <td> specifies a minimum and not a maximum.
> > Consequently I'll use a DIV because I can specify a width that is the
> > maximum (anything exceeding that maximum will wrap automatically - which[/color]
> is[color=green]
> > what I want).
> >
> > That takes care of the overall width being limited. Now we still have to
> > style each of the 3 data values uniquely (will be using css - as in
> > class=x). The requirement to format each data value uniquely will be met[/color]
> by[color=green]
> > placing each data value in its own DIV for which the css class is[/color]
> specified.[color=green]
> >
> > My concern is that this all results in three DIVs nested within another[/color]
> DIV[color=green]
> > (the 3 for the data values and the "outer DIV" to limit the overall[/color]
> width).[color=green]
> > Maybe this is a reasonable thing to do - maybe not.
> >
> > FWIW: these nested DIVs would be located within a <TD> for general[/color]
> placement[color=green]
> > on the page - as I'm using a table layout.
> >
> > Is this a reasonable way to get the desired result or is there a better[/color]
> way?[color=green]
> >
> > Thanks!
> >
> >[/color]
>
>[/color]


Closed Thread


Similar ASP.NET bytes