Pergunta

I created this simple "pop-up" tool, that when you hover on a specific text it displays a definition of that text. Here is how it's done http://jsfiddle.net/D4PzD/ when you hover on "definition link" you'll see it shows a box with some text.

so the basic structure of it is:

<span class="title">Title of definition</span>
<span class="def_box">Content that appears on hover here</span>

The problem I'm having is that if I add any html markup in the def_box like a list tag <ul> or <p> the def_box breaks. Here is an example: http://jsfiddle.net/FDEKY/

The css:

span.title {
position: relative;
display: inline-block;
border-bottom: 1px dotted #2693e0;
cursor: help;
color: #000;
}
span.def_box {
display: none;
width: 400px;
position: absolute;
height: auto;
left: 25px;
font-size: 17px;
z-index: 400;
line-height: 22px;
border: 2px solid #2693e0;
outline: 5px solid #fff;
overflow: hidden;
padding: 13px 20px;
background: #fff;
}
span.title:hover + span.def_box {
display: block;
}
Foi útil?

Solução 2

I found a way around it and "fixed" it. Here is how I did it if anyone is curious: http://codepen.io/roxi_t/pen/Fbldu

Outras dicas

<ul>s are not allowed inside <span>s

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top