1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CSS Help - Want To Show A Box Like This :-

Discussion in 'Styling and Customization Questions' started by TheBigK, Aug 9, 2012.

  1. TheBigK

    TheBigK Well-Known Member

    I'm trying to enclose some text in the box like this -

    --|LABEL|----------------------
    |. . . . . . . . . . . . . . . . . . . . . . . . |
    |. . . . . . . . . . . . . . . . . . . . . . . . |
    |. . . . . . . . . . . . . . . . . . . . . . . . |
    |. . . . . . . . . . . . . . . . . . . . . . . . |
    |. . . . . . . . . . . . . . . . . . . . . . . . |
    ----------------------------------

    Ignore the dots in the space. I've seen such boxes done entirely in CSS. Can someone tell me how exactly to add a label in a line? :)
     
  2. MagnusB

    MagnusB Well-Known Member

    You need to use fieldset and legend:
    Code:
    <fieldset>
    <legend>LABEL</legend>
    </fieldset>
    The rest is just CSS.
     
    TheBigK likes this.
  3. TheBigK

    TheBigK Well-Known Member

    Thanks, I'm checking how to make this work.
     
  4. MagnusB

    MagnusB Well-Known Member

    I am sure that there are other ways of doing it, but this strikes me as the easiest way. You then just treat the fieldset as any other div.
     

Share This Page