2017-01-09 1 views
0

나는 다음과 같은 도구 설명이 있습니다표시 요소

#left_div { 
 
    max-height:170px; 
 
    overflow-x:hidden; 
 
    overflow-y:scroll; 
 
} 
 
a.tditems_tooltip { 
 
    position: relative; 
 
    display: inline-block; 
 
    text-decoration:none; 
 
} 
 
a.tditems_tooltip span { 
 
    position: absolute; 
 
    max-width:400px; 
 
    color:#FFFFFF; 
 
    line-height:16px; 
 
    padding:0; 
 
    background:url('/layouts/background.gif'); 
 
    border: 1px solid #CFB57C; 
 
    text-align: center; 
 
    display: none; 
 
    text-decoration:none; 
 
    font-size: 12px; 
 
    box-shadow: 0 1px 4px #AAAAAA; 
 
} 
 
a.tditems_tooltip span:after { 
 
    content: ''; 
 
    position: absolute; 
 
    top: 100%; 
 
    left: 0%; 
 
    margin-left: 150px; 
 
    max-width:800px; 
 
    text-decoration:none; 
 
} 
 
a:hover.tditems_tooltip span { 
 
    display: inline-block; 
 
    bottom: 100%; 
 
    left: 0%; 
 
    margin-left: -3px; 
 
    z-index: 1000; 
 
    text-decoration:none; 
 
}
<table border="0" cellspacing="1" cellpadding="1" width="400" height="300"> 
 
    <tr> 
 
    <td width="50%"> 
 
     <div id="left_div"> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     <a class="tditems_tooltip"> 
 
      <font color="red">TRIGGER</font> 
 
      <span> 
 
      <table border="0" cellspacing="0" cellpadding="1" width="300"> 
 
       <tr bgcolor="green"> 
 
        <td>CONTENT OF TOOLTIP</td> 
 
       </tr> 
 
      </table> 
 
      </span> 
 
     </a> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </div> 
 
    </td> 
 
    <td width="50%">INSIGNIFICANT CONTENT</td> 
 
    </tr> 
 
</table>

그리고 지금까지 그것은 내가 의도와 무엇을 거의 완벽하게 작동한다. .. 한 가지를 제외하고는 : 툴팁 (span)은 페이지의 다른 모든 요소의 맨 위에 표시되지 않고 그 뒤에 표시됩니다. 위의 스 니펫을 확인하십시오.

참고 : 나는 CSSoverflow-xtd에서 overflow-y에서 제거 할 때가 의도하는 방법을 보여줍니다,하지만 난 아직도 그 tdmax-height를 지정해야합니다 ...

아이디어가 있으십니까?

+0

당신이해야 할 일입니다 (BTW, 내가 추가 한 스타일 a.tditems_tooltip span > table 미만),하지만 당신은 여전히 ​​최대 높이를 지정해야 의미합니까? 당신이 지금 가지고있는 최대 높이와 ​​높이는 그 값이 무효이기 때문에 무시되고 있기 때문에, 그 중 아무 것도 필요하지 않습니다. –

+0

@MichaelCoker 죄송합니다. 지금 스 니펫을 실행할 수 있습니까? –

+0

변경된 것을 볼 수 있지만 동작은 여전히 ​​동일하게 보입니다. 요소에서'오버플로 (overflow) '를 제거하면 요소가 수정됩니다. 'max-height'의 동작은'overflow'가 정의되어 있는지 여부에 상관없이 같습니다. 오버플로를 제거하는 것이 잘못된 이유는 무엇입니까? –

답변

0

position: fixed;을 자식 요소에 추가하면 DOM 요소에서 해당 요소의 부모 흐름에서 제거되므로 자식 요소는 부모 요소의 모든 overflow 속성을 무시합니다.

툴팁이 포함 된 테이블에 고정 위치 지정을 지정하면 부모의 오버플로 속성 외부에서 해당 요소가 강제로 배치되지만 절대적으로 배치 된 스팬 요소 내에서 자체 위치가 다르기 때문에 transform: translateY(-100%);을 적용하여 예. 원하는대로 작동하도록 요소의 레이아웃을 다시 작업해야 할 수도 있습니다. TD를에서 오버 플로우를 제거

#left_div { 
 
    max-height:170px; 
 
    overflow-x:hidden; 
 
    overflow-y:scroll; 
 
} 
 
a.tditems_tooltip { 
 
    position: relative; 
 
    display: inline-block; 
 
    text-decoration:none; 
 
} 
 
a.tditems_tooltip span { 
 
    position: absolute; 
 
    max-width:400px; 
 
    color:#FFFFFF; 
 
    line-height:16px; 
 
    padding:0; 
 
    background:url('/layouts/background.gif'); 
 
    border: 1px solid #CFB57C; 
 
    text-align: center; 
 
    display: none; 
 
    text-decoration:none; 
 
    font-size: 12px; 
 
    box-shadow: 0 1px 4px #AAAAAA; 
 
} 
 
a.tditems_tooltip span:after { 
 
    content: ''; 
 
    position: absolute; 
 
    top: 100%; 
 
    left: 0%; 
 
    margin-left: 150px; 
 
    max-width:800px; 
 
    text-decoration:none; 
 
} 
 
a:hover.tditems_tooltip span { 
 
    display: inline-block; 
 
    bottom: 100%; 
 
    left: 0%; 
 
    margin-left: -3px; 
 
    z-index: 1000; 
 
    text-decoration:none; 
 
} 
 
a.tditems_tooltip span > table { 
 
    position: fixed; 
 
    transform: translateY(-100%); 
 
}
<table border="0" cellspacing="1" cellpadding="1" width="400" height="300"> 
 
    <tr> 
 
    <td width="50%"> 
 
     <div id="left_div"> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     <a class="tditems_tooltip"> 
 
      <font color="red">TRIGGER</font> 
 
      <span> 
 
      <table border="0" cellspacing="0" cellpadding="1" width="300"> 
 
       <tr bgcolor="green"> 
 
        <td>CONTENT OF TOOLTIP</td> 
 
       </tr> 
 
      </table> 
 
      </span> 
 
     </a> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </br> 
 
     </div> 
 
    </td> 
 
    <td width="50%">INSIGNIFICANT CONTENT</td> 
 
    </tr> 
 
</table>

+0

omg! 고마워요 –

+0

@ 빅터 유고 \ m/\ m/오신 것을 환영합니다! –