Jump to content

CSS BOX border


hmvrulz

Recommended Posts

Well, what they have done is kind of a hack, in that that is supposed to enclose form inputs, but this is how you can do it:

 

<fieldset>
   <legend>free products</legend>
   <p>some copy about what they will find...</p>
</fieldset>

 

You may not need the fieldset tags - I've never tried without (fieldsets and legends go together).

Link to comment
Share on other sites

it would be so much easier to just use semantic markup... you can play around a little but the example below would achieve the desired layout except the header would not be centered - you'll just have to play a little more...

 

<div class="infoitem">

<h2>Section Title</h2>

<p>some copy about what they will find...</p>

</div>

 

the css

 

div.infoitem { border: 1px solid #ccc; margin-top: 1.5em; }

 

div.infoitem h2 { float: left; position: relative; top: -1em; margin: 0 0 -1em 20px; background: #fff; color: #ccc }

 

 

Link to comment
Share on other sites

it would be so much easier to just use semantic markup... you can play around a little but the example below would achieve the desired layout except the header would not be centered - you'll just have to play a little more...

 

<div class="infoitem">

<h2>Section Title</h2>

<p>some copy about what they will find...</p>

</div>

 

the css

 

div.infoitem { border: 1px solid #ccc; margin-top: 1.5em; }

 

div.infoitem h2 { float: left; position: relative; top: -1em; margin: 0 0 -1em 20px; background: #fff; color: #ccc }

 

 

 

 

I agree completely. Because in my experience, the fieldset/legend/etc are interpreted differently by different browsers. Check how it looks in FF, then IE, and then safari. I almost guarantee it wont look the same.

Link to comment
Share on other sites

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.