我对如何提出这个问题并不积极,但如果你看一下这个 jsfiddle,你可以看出我的跨度的宽度与我的输入的宽度是不同的,尽管它们都表示为 14% 500px 父元素。(7 x 14% = 98%)。
HTML:
<div class="timesheet-subheader-weekdays-div">
<span id="timesheet-subheader-monday" class="timesheet-subheader-weekday">Mon<br /></span>
<span id="timesheet-subheader-tuesday" class="timesheet-subheader-weekday">Tue<br /></span>
<span id="timesheet-subheader-wednesday" class="timesheet-subheader-weekday">Wed<br /></span>
<span id="timesheet-subheader-thursday" class="timesheet-subheader-weekday">Thu<br /></span>
<span id="timesheet-subheader-friday" class="timesheet-subheader-weekday">Fri<br /></span>
<span id="timesheet-subheader-saturday" class="timesheet-subheader-weekday">Sat<br /></span>
<span id="timesheet-subheader-sunday" class="timesheet-subheader-weekday">Sun<br /></span>
</div>
<div class="timesheet-daily-entry-fields-container">
<input id="TimesheetMondayHours" class="timesheet-daily-input timesheet-monday-hours"/>
<input id="TimesheetTuesdayHours" class="timesheet-daily-input timesheet-tuesday-hours"/>
<input id="TimesheetWednesdayHours" class="timesheet-daily-input timesheet-wednesday-hours"/>
<input id="TimesheetThursdayHours" class="timesheet-daily-input timesheet-thursday-hours"/>
<input id="TimesheetFridayHours" class="timesheet-daily-input timesheet-friday-hours">
<input id="TimesheetSaturdayHours" class="timesheet-daily-input timesheet-saturday-hours"/>
<input id="TimesheetSundayHours" class="timesheet-daily-input timesheet-sunday-hours"/>
</div>
CSS:
.timesheet-subheader-weekdays-div {
position:relative;
float:left;
width:500px;
}
.timesheet-subheader-weekday {
position:relative;
float:left;
width:14%;
text-align:center;
line-height:15px;
font-size:11px;
}
.timesheet-daily-entry-fields-container {
position:relative;
float:left;
width:500px;
}
.timesheet-daily-input {
position:relative;
float:left;
width:14%;
text-align:center;
}