我设计了一个文本区域,使它看起来像三个独立的文本输入框。出于样式目的,需要有一条黑线分隔每行文本。
但是,我不知道如何对齐文本,使它们感觉在各自的部分居中。任何人都可以伸出援助之手吗?
HTML
<div id="formPage">
<div id="formBox">
<div class="formSection" style="border:1px solid black;">
<div class="formLine" style="height:49px;position:relative;">
<div class="indent">This is a needed label that I put over the textarea that describes what people are filling out.</div>
<div class="whiteIndent"></div>
<div class="borderIndent"></div>
<div class="whiteIndent2"></div>
<div class="borderIndent2"></div>
<textarea name="text1" class="indent" rows="3" maxlength="360"></textarea>
</div>
</div>
</div>
CSS
* { }
*, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
#formPage {
font-family: 'Arial Narrow', Arial, sans-serif;font-size:13px;
background:#fff;
border: 1px solid #d8d8d8;
border-bottom-width: 2px;
border-top-width: 0;
width:910px;
margin:0 auto;
padding:30px;
height:100px;
}
.formLine > textarea.indent {
position:absolute;
font-family: 'Arial Narrow', Arial, sans-serif;
font-size:13px;
background-color:#E2F4FE;
width:818px;
z-index:0;
top:0px;
padding: 0;
outline: 0;
border:0;
resize:none;
overflow:hidden;
box-sizing: border-box;
}
.formLine > div.indent { position:absolute;z-index:2;top:0;background-color:#fff;padding:2px 2px 2px 1px; }
.formLine > div.whiteIndent { position:absolute;z-index:2;top:16px;width:820px;height:3px;background-color:#fff; }
.formLine > div.borderIndent { position:absolute;z-index:2;top:17px;left:0;border-top:1px solid #000;width:823px;height:1px; }
.formLine > div.whiteIndent2 { position:absolute;z-index:2;top:32px;width:820px;height:3px;background-color:#fff; }
.formLine > div.borderIndent2 { position:absolute;z-index:2;top:33px;left:0;border-top:1px solid #000;width:823px;height:1px; }
.formSection { float:left;width:825px;border-right:2px solid #000;border-bottom:1px solid #000;font-size:13px;}