CSS Header Header

Is it possible to make a div header like this:

enter image description here

I know that the text β€œDiv Title here” inside the div could give it a solid background and position it with absolute coordinates, but I would like the title to be associated with the div and not with the whole document, so I can move the div, without worrying about moving the title.

I created a fiddle here: http://jsfiddle.net/Eth6U/ .

+6
source share
5 answers

You can use the <fieldset> for this ...

Here is an example ...

 <fieldset> <legend>Div title here...</legend> </fieldset> 

You can edit the <fieldset> in the same way as the <div> in CSS ...

+9
source

You can use the fieldset and legend tags.

For instance:

 <fieldset> <legend>The title</legend> <p>hello!</p> </fieldset> 
+5
source

sounds like you're looking for fieldset and legend .

 <fieldset> <legend>Title</legend> ... </fieldset> 
0
source

This was discussed on SitePoint.com , and it seemed the best way to do this was to embed the div in the div and use the negative fields to position it correctly, which I think you don't want to do.

What you are trying to do is very similar to the fieldset legend for forms, and you can use this html and style it with CSS to customize it. Examples

0
source
 <fieldset> <legend>Div Title Here</legend> <!-- Write your code here what do you want in that fieldset--> </fieldset> 
0
source

Source: https://habr.com/ru/post/917802/


All Articles