CSS 만 사용하여 앵커 태그에 대한 툴팁을 만들려고합니다. 나는 온 이 멀리. 텍스트의 길이에 관계없이 상자와 팁 화살표가 정확히 중앙에 배치되는 기능을 달성하려고합니다.
위의 이미지는 내가 얻으려는 것입니다. 나는 유지하려고 노력했지만 width:auto
작동하지 않습니다.
body
{overflow-x:hidden;}
div
{position:relative;width:700px;border:1px red solid;padding:20px;margin:0 auto;text-align:justify;}
a
{position:relative;white-space:nowrap;}
a > span.tooltip
{
position: absolute;
white-space: normal;
width: 100%;
top: 130%;
left: 0;
}
a > span.tooltip > span
{
position: absolute;
top: 0;
right: 0;
text-align: center;
bottom: 0;
left: -500%;
width: 1100%;
}
a > span.tooltip > span > span
{
display: inline-block;
background: black;
border-radius: 4px;
padding: 10px;
color: white;
max-width: 300px;
}
데모 : http://jsfiddle.net/b2Yqf/
msie78 9 10, firefox, chrome에서 작동
마크 업이 세 개의 중첩 된 <span>
s 로 만들어지기 때문에 원하는 것이 아닙니다 .하지만 YES. 할 수 있습니다!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다