html - 为什么没有明确大小的 div 中的链接和文本会中断?

标签 html css

我试着有一个工具提示,它有标题和内容,大小应该是自动的。这意味着标题不应中断,内容应相应地适合。

这里的标题和内容都坏了为什么会坏?如何避免这种情况?这可以在不指定高度和宽度的情况下完成吗?

代码

HTML

<div class="wrap">
    link
    <div class='arrow'></div>
<div class="left">
    <div class="tit"><a href="#">This is a big text link</a></div>
    <div class="content"> Hello this are contents so if the content is big</div>
</div>
</div>

CSS

  .left{
      background: none repeat scroll 0 0 #FF0000;
      left:100%;
      position: absolute;
      top: -50%;
      padding:20px;
}
.wrap{
    left: 0;
    position: fixed;
    top: 50%;

}
.arrow
{
    border-bottom: 20px solid rgba(0, 0, 0, 0);
    border-right: 25px solid #008000;
    border-top: 20px solid rgba(0, 0, 0, 0);
    height: 0;
    left:0;
    position: absolute;
    width: 0;
}

JSFIDDLE

最佳答案

.wrap 宽度提到 100%

试试这段代码:

DEMO

.wrap{
    left: 0;
    position: fixed;
    top: 50%;
    width:100%;

}

关于html - 为什么没有明确大小的 div 中的链接和文本会中断?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21454570/

相关文章:

php - 如何使用php中下拉列表框中的选定值显示数据库中的特定字段

html - CSS:悬停时着色圆形div?只在 div 后面着色?

jquery - 仅在单击父级 li 时切换 ul 子菜单的显示

jquery - 带水平线和垂直线的两行 slider ?

css - 如何设置滚动页面的背景颜色?

html - 如何使 div 的高度在聊天中的所有设备上响应?

asp.net - IFrame:此内容无法在框架中显示

javascript - window.onbeforeunload 与表单

不支持的 column-break-before 属性的 JavaScript 回退

html - 显示 : block showing all my <span>s inline