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
https://forums.phpfreaks.com/topic/113068-css-box-border/#findComment-580842
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
https://forums.phpfreaks.com/topic/113068-css-box-border/#findComment-582617
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
https://forums.phpfreaks.com/topic/113068-css-box-border/#findComment-582669
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.