Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS div title position

Tags:

html

css

title

Is it possible to make a div title appear like this:

enter image description here

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

I have set up a fiddle here: http://jsfiddle.net/Eth6U/.

like image 659
jeffery_the_wind Avatar asked Jun 11 '12 14:06

jeffery_the_wind


People also ask

How do you move a title down in CSS?

Relative Positioning Move Left - Use a negative value for left. Move Right - Use a positive value for left. Move Up - Use a negative value for top. Move Down - Use a positive value for top.

How do you move a title in HTML?

To set the heading alignment in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <h1> to <h6> tag, with the CSS property text-align. HTML5 do not support the align attribute of the heading tag, so the CSS style is used to set alignment.

How do you change the style of the title attribute?

You can't style an actual title attribute How the text in the title attribute is displayed is defined by the browser and varies from browser to browser. It's not possible for a webpage to apply any style to the tooltip that the browser displays based on the title attribute.


1 Answers

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

Here's an example...

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

You can edit the <fieldset> tag just as a <div> in CSS...

like image 180
shahbaz Avatar answered Sep 22 '22 10:09

shahbaz