我有以下页面:
<!DOCTYPE html>
<html>
<head>
<title>The Divine Liturgy</title>
<meta charset='utf-8'>
<style type='text/css'>
body
{
font-family: Verdana, Arial, sans;
}
.ui-tooltip, .ui-widget, .ui-corner-all, .ui-widget-content,
.ui-tooltip-content
{
background-color: #ffff00;
width: 800px;
}
</style>
<link rel='stylesheet' type='text/css'
href='/js/jquery-ui-1.10.2.custom/css/smoothness/jquery-ui-1.10.2.custom.css'
/>
</head>
<body>
<p title="Bless, Master!">Deacon: Blagoslavie, Vladyko!</p>
<p title="Blessed is the Kingdom of the Father, and of the Son, and of the Holy Spirit: Now and ever, and unto the ages of ages.">Priest: Blagoslovenno tsarsvo Otsa i Sina, i Svatago Duha, nine e presno, i vo beki vekov.</p>
<p title="Christ is risen from the dead, trampling down death by death, and on those in the tombs bestowing life!">Clergy: Hristos voskrece iz mertvih, smertyio smert poprav, i sushim vo grodex zhevot darovav!</p>
<script src='/js/vendor/jquery-1.8.2-min.js'></script>
<script
src='/js/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js'></script>
<script>
jQuery(document).tooltip();
</script>
</body>
</html>
我已经在 CSS 类上尝试了几种排列,它目前的行为是根据需要以更宽的宽度显示黄色背景悬停,但黑色和白色边框区域也没有扩展 - 因此工具提示悬停在内容溢出了右边界——不符合预期。
如何要求包含框适合 800px 内部包含 div?
谢谢
最佳答案
在这里,您将 800px 宽度应用于内容,但是,.ui-tooltip
类是在 jqueryui css 中使用 max-width:300px;
定义的文件。
您的 width: 800px;
无效。
您必须分离您的类并覆盖 max-width
:
body
{
font-family: Verdana, Arial, sans;
}
.ui-tooltip{
max-width: 800px;
width: 800px;
}
.ui-tooltip-content{
background-color: #ffff00;
}
不要覆盖ui-corner
、ui-widget
...或其他类。您稍后可能需要它们。只需修改此处涉及的 ui-tooltip
即可;)。
关于jquery - 如何优雅地展开 jQuery UI 工具提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16565053/