Technical Discussion
  >> Web Design / HTML / Web hosting Forum


Register (or login) on our website and you will not see this ad.


These posts have been archived and can no longer be replied to or modified.
  Print Thread
Standard User deleted
(deleted) Thu 03-Aug-06 13:32:04
Print Post

CSS and <fieldset> / <legend> issue


[link to this post]
 
Trying to style a fieldset with a legend.

Essentially, I want to remove the border from the fieldset and make it appear as a header with a blue bar as the background. At present I've resorted to using custom <h1> tags.

When I style the <legend> tag, I can't seem to get it to stretch across the page. It acts like a group header and refuses to expand to more than a minimal width to accommodate text.

Anyone know how I can fix this?
Standard User camieabz
(legend) Thu 03-Aug-06 13:53:53
Print Post

Re: CSS and <fieldset> / <legend> issue


[re: deleted] [link to this post]
 
Perhaps putting the field inside its own div and making the div width 100%, or the percentage that you want?

In defeat he fled. In revolution he abdicated. In exile he remarried.

Camie

SAR 715...plusnet...1944 / 248

~ The AG'ers Mugshots ~

~ Camie's Forums ~
Standard User deleted
(deleted) Thu 03-Aug-06 14:29:19
Print Post

Re: CSS and <fieldset> / <legend> issue


[re: deleted] [link to this post]
 

fieldset { border: 0; }
legend { width: 100%; background-color: blue;}


That what you want? Sounds like your description anyway!

Edited by deleted (Thu 03-Aug-06 14:31:34)


Register (or login) on our website and you will not see this ad.

Standard User deleted
(deleted) Thu 03-Aug-06 20:56:43
Print Post

Re: CSS and <fieldset> / <legend> issue


[re: deleted] [link to this post]
 
That's what I tried... :/
Standard User deleted
(deleted) Fri 04-Aug-06 19:29:58
Print Post

Re: CSS and <fieldset> / <legend> issue


[re: deleted] [link to this post]
 
Well it worked on my machine, or at least it did what I expected you were after from reading your post...

What exactly does it do on your machine, and how does it differ from what you want?
Standard User deleted
(deleted) Fri 04-Aug-06 21:04:33
Print Post

Re: CSS and <fieldset> / <legend> issue


[re: deleted] [link to this post]
 
I was after having a blue background to it, and have the <legend> spanning the entire width of the containing element.

My code - as far as I can remember (it's gone now) went something like this:
legend
{
width: 100%;
background-color: blue;
color: white;
}

The fieldset had it's border removed, as well.

Instead of going across the entire container element, it was only as wide as the text inside it.
  Print Thread

Jump to