Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Imitating a FIELDSET from a DIV

    Hey. I have a small dilema here.

    From what I've learned so far, I understand that <fieldset>s have very crappy compatibility with a wide range of browsers.

    I am looking to make a DIV imitate a fieldset with a legend. Basicly, this is what I want to do:



    Does anyone know any way to do this?

    Much appreciated,
    ralxz.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What browsers would you be talking about? The current browsers out now support fieldsets fine, as does opera 7.54 and IE5.5 and possibly even IE5.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
    margin:0;
    padding:0;
    background:#CCC;
    color:#000;
    font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif;
    font-size:0.8em;
    }
    .fieldset {
    width:390px;
    height:390px;
    margin:20px auto;
    position:relative;
    border:1px solid #000;
    padding:5px;
    }
    .legend {
    position:absolute;
    left:30px;
    top:-10px;
    background:#CCC;
    color:#000;
    font-weight:bold;
    padding:0 5px;
    }
    </style>
    </head>
    
    <body>
    <div class="fieldset"><div class="legend">Legend</div>
    This is similar to a fieldset though not very semantical.
    </div>
    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •