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.
For the four borders, we need four <fieldset> elements, each containing a <legend> element inside. We add the text that will appear at the borders inside the <legend> elements. To begin, we stack the <fieldset> elements on top of each other in a grid cell and give them borders.
Use the -webkit-text-stroke Property to Apply Borders to Font in CSS. We can use the text-stroke property on a text to apply borders to a font in CSS. We need to use the webkit prefix ahead of the text-stroke property to use the feature. However, it only works on the web-kit based browsers like Safari and Chrome.
Using Inline Style attribute Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to use the inline property for adding the border. Step 2: Now, place the cursor inside the opening tag of that text around which we want to add the border.
Yes, but it's not a div
, it's a fieldset
fieldset { border: 1px solid #000; }
<fieldset> <legend>AAA</legend> </fieldset>
You can do something like this, where you set a negative margin
on the h1
(or whatever header you are using)
div{ height:100px; width:100px; border:2px solid black; } h1{ width:30px; margin-top:-10px; margin-left:5px; background:white; }
Note: you need to set a background
as well as a width
on the h1
Example: http://jsfiddle.net/ZgEMM/
EDIT
To make it work with hiding the div
, you could use some jQuery like this
$('a').click(function(){ var a = $('h1').detach(); $('div').hide(); $(a).prependTo('body'); });
(You will need to modify...)
Example #2: http://jsfiddle.net/ZgEMM/4/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With