Jump to content

MULTIPLE LEGENDS IN ONE FIELDSET


freelance84

Recommended Posts

Does anybody know if it is possible to have multiple legends on the same fieldset?

 

Here's an example of what I trying to do:

<legend align="left">pre</legend>
<legend align="center"><u>Creating $sName</u></legend>
<legend align="right">next</legend>

 

With the above code I get the "pre" in the fieldset lines but the others inside.

 

I've attached a picture of what I am trying to achieve. I've had a search on the old goggle pages and this forum but nothing has really turned up.

 

Does anyone know if this is possible? And if so how?

 

Much thanks for any replies

 

[attachment deleted by admin]

Link to comment
Share on other sites

What amazes me is that you ask this question while you could have just read the DTD@http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict or validate it using your IDE or W3 validator.

 

And what's a <legend>-tag? Nothing special just a tag with some default style applied to, you can use any tag you like (as many times you like, or one with the accesskey attribute if you want to maintain accessibility).

 

Or for semantics sake, you could write:

 

<fieldset>
  <legend class="legend left">..</legend>
  <div class="legend center">..</div>
  <div class="legend right">..</div>
  ..
</fieldset>

Link to comment
Share on other sites

I am no expert in CSS and have actually no idea what the browser applied CSS-rules are for the <legend>-tag but I tried and worked:

 

<fieldset>
  <legend style="display: block; float: left; margin-top: -17px; background-color: #FFF; padding: 0 5px;">test</legend>
  <div style="display: block; float: right; margin-top: -17px; background-color: #FFF; padding: 0 5px;">test</div>
  test
</fieldset>

 

If you use a reset script (cf Eric Meyer) you'll notice the <legend>-tag is no longer where it used to be. It's quite possible the browser uses background-color: inherit for the <legend>-tag to animate no line under the tag itself from the <fieldset>.

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.