html - HTML/CSS 上的额外像素

标签 html css

我想将我的文本放在网页的某个部分,但是当我将 left: 0px; 更改为 left: 130px; 时,它创建的像素导致出现单杠。知道如何解决这个问题吗?

CSS

.main4{
text-align: left;
left: 0px;
line-height: 70px;
margin-top: -30px;
position: absolute;
top: 8px;
width: 98.7%;
font-family: "Times New Roman", Times, serif;
font-size: 18px;
margin-bottom: 0px;
display: block;
}

HTML

<div class="main4">
<h1>Upon Doctor's advice</h1>
<h1>Upon advice by family, friends, relatives, another previous patient</h1>
<h1>Recommended by hospital employee</h1>
<h1>Employee's hospital privilege</h1>
<h1>Reputation as the center of best doctors</h1>
<h1>Recommended for good nursing care</h1>
<h1>Others (Please specify): </h1>
</div>

左:130px;

enter image description here

左:0px;

enter image description here

最佳答案

只需删除 width: 98.7%;

.main4{
text-align: left;
left: 130px;
line-height: 70px;
margin-top: -30px;
position: absolute;
top: 8px;
font-family: "Times New Roman", Times, serif;
font-size: 18px;
margin-bottom: 0px;
display: block;
}
<div class="main4">
<h1>Upon Doctor's advice</h1>
<h1>Upon advice by family, friends, relatives, another previous patient</h1>
<h1>Recommended by hospital employee</h1>
<h1>Employee's hospital privilege</h1>
<h1>Reputation as the center of best doctors</h1>
<h1>Recommended for good nursing care</h1>
<h1>Others (Please specify): </h1>
</div>

关于html - HTML/CSS 上的额外像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44711411/

相关文章:

java - 如何在游戏中将操作分配给复选框!对于java

javascript - 突出显示 HTML 表格中的所有数据

html - 行后的 Bootstrap 4 div 导致列出现问题

css - 如何防止屏幕调整大小时 HTML 表格的中间列被挤压?

javascript - 获取没有 DOM 元素的 css 值

javascript - 使用外部控件显示下拉菜单

javascript - HTML5 中的下载进度

javascript - 在动态创建的列表 jquery-ui 上使用 connectWith

javascript - 仅当页面在 css 中滚动时显示滚动条

css - Visual Composer - 在桌面和移动设备上隐藏/显示