CSS effect question.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cheesecaker
    New Member
    • Feb 2007
    • 66

    CSS effect question.

    I'm looking to achieve a particular effect using CSS. This is a rough sketch of it:


    Does anyone know the code required for this?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Semantically, we shouldn't do it this way but it validates and works.
    [html]
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <fieldset>
    <legend><span style="border:1 px solid">Text</span></legend>
    <p>More text</p>
    </fieldset>
    </body>
    </html>
    [/html]

    <fieldset> is actually supposed to be inside a <form> and even a <p> so I'm surprised it validated.

    I've seen this somewhere before but never did it myself. I would have done it differently but don't have time tonight.

    Comment

    • cheesecaker
      New Member
      • Feb 2007
      • 66

      #3
      Thank you. Any other ideas? Is there any way to control how far from the left the <legend> box is?

      Comment

      • vkfmj
        New Member
        • Jun 2007
        • 3

        #4
        Originally posted by cheesecaker
        Thank you. Any other ideas? Is there any way to control how far from the left the <legend> box is?
        Yes, you can use the margin attribute: (from O'REILLY'S CSS ref)

        margin-bottom: marginThickness | auto
        margin-left: marginThickness | auto
        margin-right: marginThickness | auto
        margin-top: marginThickness | auto

        default is 0

        Example:
        blockquote {margin-left: 20; margin-top: 10}
        #narrowCol {margin-left: 30%; margin-right: 30%}

        Comment

        • cheesecaker
          New Member
          • Feb 2007
          • 66

          #5
          Thank you all for the answers. I got it to work just fine. I've got a related question, now though. How would this be implemented?



          Or basically, positioning the legend box anywhere along the border.

          Comment

          Working...