[英]Unexpected issue in Css3 html5 Div alignement when applying border-left
I'm trying to produce a report using html5 and css3 but I got an unexpected behavior. 我正在尝试使用html5和css3生成报告,但出现意外情况。 what I need is to understand Why div are not aligned
我需要的是理解为什么div不对齐
CSS3 CSS3
.lineDiv{ border-left: 5px solid #FF0000; background:whitesmoke;height:30px; margin-top: 10px; }
/* */
.titleDiv {border-bottom:5px solid OrangeRed;border-top: 4px solid #FFFFFF; text-align: center; ;background:gainsboro;height: 50px; font-size: 18px;color:#2F4F4F ; font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif; font-weight:bold; text-shadow: 1px 1px white;}
.mainDiv{
margin: auto;height: 600px;width: 600px; border: 1px solid gray; }
.bodyDiv
{
margin: 10%;
align-content: center;
}
.labelP
{ float: left; margin-top: 7px;width: 80px; border-right: 1px solid white;vertical-align: middle;
text-align:left; font-size: 15px;color:#2F4F4F ; font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif; font-weight:bold; text-shadow: 1px 1px white;
}
.labelTxt
{display: inline-block; ; margin-top: 7px;width: 80px; vertical-align: middle;width:auto;
text-align:left; font-size: 15px;color:#2F4F4F ; font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif; text-shadow: 1px 1px white;
}
.sectionDiv {border-right:5px solid OrangeRed;border-left:5px solid OrangeRed; text-align: center; ;background:gainsboro;height: 24px; font-size: 16px;color:#2F4F4F ; font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif; font-weight:bold; text-shadow: 1px 1px white; margin-bottom: 5px;}
HTML5 HTML5
<html>
<head>
<title>Job Alert</title>
</head>
<body>
<!-- Start your code here -->
<div class="mainDiv">
<div class="titleDiv"><p>Unexpected result detected</p></div>
<!-- Body Div-->
<div class="bodyDiv">
<div class="sectionDiv">Job Information</div>
<div class="lineDiv"><span class="labelP">Name </span><span class="labelTxt"> GUI TEST </span><div>
<div class="lineDiv"><span class="labelP">JID </span><span class="labelTxt">12345 </span><div>
<div class="lineDiv"><span class="labelP">JID </span><span class="labelTxt">12345 </span><div>
</div>
</div>
</div></div></div></div></div></div></body>
Result following is the permanent link http://liveweave.com/z25PTh on liveweave 结果如下是liveweave上的永久链接http://liveweave.com/z25PTh
SO why div are not aligned? 那么为什么div不对齐? Can anyone explain or optimize this code ?
谁能解释或优化此代码?
you have not closed your div blocks, close div blocks... 您尚未关闭div块,关闭div块...
<div class="lineDiv"><span class="labelP">Name </span><span class="labelTxt"> GUI TEST </span>**<div> <------- </div>**
<div class="lineDiv"><span class="labelP">JID </span><span class="labelTxt">12345 </span>**<div> <------- </div>**
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.