I'd like to have a div that looks like this:
Is this possible to do with HTML + CSS? I will also be animating this div with jQuery. When the div is hidden I would like the title and the top line to show.
I'd like to have a div that looks like this:
Is this possible to do with HTML + CSS? I will also be animating this div with jQuery. When the div is hidden I would like the title and the top line to show.
You can do something like this, where you set a negative
margin
on theh1
(or whatever header you are using)Note: you need to set a
background
as well as awidth
on theh1
Example: http://jsfiddle.net/ZgEMM/
EDIT
To make it work with hiding the
div
, you could use some jQuery like this(You will need to modify...)
Example #2: http://jsfiddle.net/ZgEMM/4/
You can use a fieldset tag.
Check this link: HTML Tag
It is possible by using the legend tag. Refer to http://www.w3schools.com/html5/tag_legend.asp
I know a bit late to the party, however I feel the answers could do with some more investigation/input. I have managed to create the situation without using the fieldset tag - that is wrong anyway as if I'm not in a form then that isn't really what I should be doing.
This can be viewed in this plunk:
Outline box with title
What this achieves is the following:
no use of fieldsets.
minimal use if CSS to create effect with just some paddings.
Use of "em" margin top to create font relative title.
use of display inline-block to achieve natural width around the text.
Anyway I hope that helps future stylers, you never know.
Yes, but it's not a
div
, it's afieldset
CSS: