html - 背景在调整大小时不会填满 div 的整个高度
问题描述
在下面的示例中,当文本有两行时,文本的背景颜色不会出现:
#Group_82 {
position: absolute;
width: 544px;
height: 66px;
left: 4px;
top: 10px;
overflow: visible;
animation: resize 2500ms linear 0s infinite;
}
.Rectangle_445 {
position: absolute;
overflow: visible;
width: 100%;
height: 66px;
left: 0px;
top: 0px;
}
#text1 {
position: absolute;
left: 20px;
right: 20px;
top: 10px;
overflow: visible;
height: 14px;
text-align: left;
font-family: Helvetica Neue;
font-style: normal;
font-weight: normal;
font-size: 12px;
color: rgba(112,112,112,1);
background-color: lightblue;
}
@keyframes resize {
0% {
width: 92%;
}
37.5% {
width: 92%;
}
50% {
width: 45%;
}
87.5% {
width: 45%;
}
100% {
width: 92%;
}
}
<div id="Group_82" class="resize92to50">
<svg class="Rectangle_445">
<rect fill="rgba(234,234,234,1)" stroke="rgba(183,183,183,1)" stroke-width="1px" stroke-linejoin="miter" stroke-linecap="butt" stroke-miterlimit="4" shape-rendering="auto" id="Rectangle_445" rx="0" ry="0" x="0" y="0" width="100%" height="66">
</rect>
</svg>
<div id="text1">
<span>The text is anchored to the left and right edge of the group</span>
</div>
</div>
解决方案
你好我有解决你的问题。
<div id="Group_82" class="resize92to50">
<svg class="Rectangle_445">
<rect fill="rgba(234,234,234,1)" stroke="rgba(183,183,183,1)" stroke-width="1px" stroke-linejoin="miter" stroke-linecap="butt" stroke-miterlimit="4" shape-rendering="auto" id="Rectangle_445" rx="0" ry="0" x="0" y="0" width="100%" height="66">
</rect>
</svg>
<div id="text1">
<span style="background-color: lightblue;">The text is anchored to the left and right edge of the group</span>
</div>
</div>
在(标签)中添加背景颜色。不要设置“text1”div的背景颜色...
推荐阅读
- python-3.x - 如何从具有相同值的python列表中删除对象?
- javascript - 如何修复 path.json 不是函数
- javascript - 如何在 Angular 6 分页的表格中打印记录。(所有记录不仅是当前页面)
- javascript - 使用 Google Apps 脚本和 JavaScript 从 google 表格反映 HTML 中的选项值
- php - 将json转换为多级数组
- python - 如何在循环中将 r 前缀包含到字符串中?
- installation - Atmel Studio 7.0 及其安装程序抛出错误:“找不到一个或多个组件。请重新安装应用程序。”
- mysql - MySql中的WHEN条件生成多列而不是一列?
- c# - 如何在 C# 表单应用程序中从 MDVR 播放 .264 格式的原始视频文件
- c# - 无法加载文件或程序集“Microsoft.ML.Api”