Welcome to WebmasterWorld Guest from 54.226.133.245

Forum Moderators: not2easy

Message Too Old, No Replies

dt and dds of different heights.

     
1:15 pm on Jun 28, 2011 (gmt 0)

New User

joined:June 28, 2011
posts:10
votes: 0


Hi people,


i'm currently facing some problems in a project i'm working on..

SORRY, THE SUBMIT BUTTON NEED IN THE FIRST DD, NOT THE SECOND!
http://img683.imageshack.us/img683/597/helpuh.png [imageshack.us]

I have a DL with DT(option) en two DDs (input field and description)
now the problem is sometimes i have a text area which is quite heigh..

so as you can see on the picture the submit button isn't on its correct place.. it should be in the first DD on the next line..

But i can't really put a height because i also have radio buttons and inputfields where i do'nt have this problem..

Anybody know whats the best way to fix?

Thanks!
1:55 pm on June 28, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


... it should be in the first DD on the next line..


Where is the submit button in your markup?

I think you might need to post some of your markup?
3:09 pm on June 28, 2011 (gmt 0)

New User

joined:June 28, 2011
posts:10
votes: 0


Hey thanks for the reply!
Check the image below
[img683.imageshack.us...]

this is the structure:

<dl>
<dt>an option</dt>
<dd>input</dd>
<dd>description of an option</dd>
....above repeated few times with different input fields....
<dt>&nbsp;</dt>
<dd>submit button ish ere </dd>
<dd>&nbsp;</dd>
</dl>

But as the text area input its height is bigger then the description its height.. the floating dt comes on the same line instead of on the next line.. check the image!

An solution would be defining special classes for text area that give the last id an height... but you might have another solution?

Thanks
4:08 pm on June 28, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


Are you clearing your DTs? Presumably each DT/DD/DD group should appear on one line. eg...
dl dt { 
clear:both;
}


...and welcome to WebmasterWorld! :)
5:50 pm on June 28, 2011 (gmt 0)

New User

joined:June 28, 2011
posts:10
votes: 0


Haha, yes indeed!

Thanks!

Solved!
4:10 pm on June 29, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Another good way to do this is the "shrink wrap" approach. It relies on the basic fact that a floated container will contain any children floated within it. So if you float everything left (or right,) float the parent container too. This is useful if you want to cut down on the number of clearing elements you need in your markup - most clearing elements are empty junk with no inherent semantic meaning.
6:41 pm on June 30, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


It relies on the basic fact that a floated container will contain any children floated within it.


Presumably this is the same principle that a parent container with
overflow:hidden
will also contain floated children?

Although I think @jonasisme is a bit stuck if using a DL. A parent container around each (DT DD DD) block would certainly invalidate the HTML.
7:51 pm on June 30, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12696
votes: 244


A parent container around each (DT DD DD) block would certainly invalidate the HTML.

Isn't the <dl> itself the parent?
10:42 pm on June 30, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


Yes the <dl> is the parent. But the way the design is structured with the <dt><dd><dd> always in a row, like so:

<dl> 
<dt><dd><dd>
<dt><dd><dd>
</dl>


...kind of warrants some kind of additional container around each <dt><dd><dd> block in order to apply rocknbil's "shrink wrap" approach. Since the initial problem seemed to be that the <dt> wasn't clearing the preceeding <dd>. But such a container would obviously be invalid. So I was really questioning whether you could even apply the "shrink wrap" approach to such a structure? May be the <dl> element is the wrong tool to begin with?
12:30 am on July 1, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Aug 9, 2008
posts: 961
votes: 0


@jonasisme and welcome to [webmasterworld.com] :)

@penders, yes the "shrink wrap" technique will work using the dl as the "container".

However, I agree there could well be problems achieving the desired layout using floats - difficult to tell as we don't have the css. ... were you thinking that a form is usually the best tool for a form?