[英]Formatting jQuery Mobile Labels and their input boxes
我在jquery中有一個標簽和一個輸入框,希望將其格式化為特定格式,但這似乎是不可能的。 這是我要實現的目標的圖片:
這是我目前擁有的HTML:
<div data-role="fieldcontain" style="width:100%;">
<label for="name" style="background:yellow;color:black;width:5%;border-top-left-radius:10px;border-bottom-left-radius:10px;padding-right:0px;height:5%;">Text Input</label>
<input type="text" name="name" id="name" value="" style="border-top-left-radius:0px;border-bottom-left-radius:0px;width:93%"/>
</div>
但我不斷得到這個:
如何獲取輸入框以填充屏幕,即寬度為93%,並且沒有上下邊界半徑? 另一個問題是文本輸入標簽的高度? height:5%
無效嗎? 請幫忙?
您可以在輸入中設置data-role="none"
,然后使用常規CSS。
這是一個演示
<div id="specialCont">
<div>
<label for="pub_url">Text Input</label>
<input data-role="none" type="text" id="pub_url" name="pub_url" value="http://cssdeck.com" />
</div>
</div>
#specialCont {
background: #165FD1;
padding: 10px 4px;
width: 100%;
margin: 0 auto;
border: 1px solid #ccc;
}
#specialCont div {
overflow: hidden;
}
#specialCont label, #specialCont input {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#specialCont label {
font-weight: normal;
background: linear-gradient(#FFFF00, #D8E404);
padding: 5px;
color: #333;
border: 1px solid #d4d4d4;
border-right: 0;
border-bottom-left-radius:2em;
border-top-left-radius: 2em;
line-height: 24px;
width: 20%;
float: left;
text-align: center;
cursor: pointer;
white-space:nowrap;
}
#specialCont input {
width: 80%;
padding: 8px;
border: 1px solid #d4d4d4;
border-bottom-right-radius: 2em;
border-top-right-radius: 2em;
line-height: 18px;
float: right;
margin-top: 0px;
box-shadow: inset 0px 2px 2px #ececec;
}
#specialCont input:focus {
outline: 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.