CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   Form inside tooltip? (http://www.codingforums.com/showthread.php?t=272531)

johnsmith153 09-08-2012 12:24 AM

Form inside tooltip?
 
I want to place a form inside a tooltip, but CSS-only tooltips are something like this:

<a>Anchor<span>Tooltip content here</span></a>

...which of course would be this:

<a>Anchor<span><form>form content</form></span></a>

...which works, but apparently isn't good standard.

What do I do?

I want to put any HTML, including <div>'s in the tooltip.

Sammy12 09-08-2012 12:27 AM

Quote:

Originally Posted by johnsmith153 (Post 1268005)
...which works, but apparently isn't good standard.

That's correct, using block elements inside inline elements is "incorrect".

You can just wrap the tooltip in a <form>:

Code:

form {
    cursor: pointer; /* ? don't know why you wrapped a form in <a> */
}
div {
    display: inline-block;
}

Code:

<form>
    <label>
        <a href="#">Anchor</a>
    </label>
    <div><!-- form content --></div>
</form>

By your original code, if the form content was clicked it would go to the <a> link. Then what's the purpose of a form?


All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.