1. 程式人生 > >對前端頁面的邊框設定

對前端頁面的邊框設定

二·如何對邊框設定:

1.<div style="text-align:center; vertical-align:middel;"><input type="text"></div>
這樣你試試,應該就是左右 上下都居中了

2.如果是讓內容顯示的居中:
<html>
<head>
<style>
body{TEXT-ALIGN: center;}
#center{ MARGIN-RIGHT: auto;
MARGIN-LEFT: auto;
height:200px;
background:#F00;
width:400px;
vertical-align:middle;
line-height:200px;
}
</style>
</head>
<body >
<div id="center"><p>test content</p></div>
</body>
</html>


input type="text",value文字設定居中但是明顯有點偏右。。。怎麼解決 
{width: 30px; height: 15px; border: 1px solid #B1CEEC; text-align: center; padding: 0; }


讓表單input等文字框為只讀不可編輯的方法:
方法1: onfocus=this.blur() 當滑鼠放不上就離開焦點
<input type="text" name="input1" value="中國" onfocus=this.blur()> 

方法2:readonly 
<input type="text" name="input1" value="中國" readonly> 
<input type="text" name="input1" value="中國" readonly="true"> 

方法3: disabled 
<input type="text" name="input1" value="中國" disabled="true">

完整的例子:

<input name="ly_qq" type="text" tabindex="2" onMouseOver="this.className='input_1'" onMouseOut="this.className='input_2'" value="123456789" disabled="true" readOnly="true" /> 

disabled="true" 此果文字會變成灰色,不可編輯。 
readOnly="true" 文字不會變色,也是不可編輯的

css遮蔽輸入:<input style="ime-mode: disabled"> 

有兩種方法
第一:disabled="disabled"這樣定義之後被禁用的 input 元素既不可用,也不可點選。
第二:readonly="readonly" 只讀欄位是不能修改的。不過,使用者仍然可以使用 tab 鍵切換到該欄位,還可以選中或拷貝其文字,能取到裡面的value值並且來用。
 
 
 
讓文字域前面的內容在文字域的左上角顯示:
<span style="float:left">車主評價:</span><textarea></textarea>

讓文字域前面的內容居中顯示:
可以通過套表格實現:
<table><tr><td><span style="float:left">車主評價:</span></td><td><textarea></textarea></td></tr></table>


div設定外邊框相關如下:
border-color:#000設定4邊邊框顏色為黑色;
border-color:+顏色值,即可設定物件邊框顏色;
border-left-color:#000 設定左邊框顏色為黑色;
border-right-color:#000 設定右邊框顏色為黑色;
border-top-color:#000 設定上邊框顏色為黑色;
border-bottom-color:#000 設定下邊框顏色為黑色;
條件:必須設定物件邊框存在,設定邊框寬度必須大於或等於1px,邊框顏色才會顯示並有存在意義。
.divcss5{ border-style:solid; border-width:1px; border-color:#000}
這樣就設定物件邊框為實線邊框,引數就是solid,邊框寬度(厚度)為1px,邊框顏色為黑色,這樣設定邊框顏色才會生效。


#rcorners1 {
    border-radius: 25px;
    background: #8AC007;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}

#rcorners2 {
    border-radius: 25px;
    border: 2px solid #8AC007;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}

#rcorners3 {
    border-radius: 25px;
    background: url(/images/paper.gif);
    background-position: left top;
    background-repeat: repeat;
    padding: 20px; 
    width: 200px;
    height: 150px;    
}
</style>
</head>
<body>

<p> border-radius 屬性允許向元素新增圓角。</p>
<p>指定背景顏色元素的圓角:</p>
<p id="rcorners1">圓角</p>
<p>指定邊框元素的圓角:</p>
<p id="rcorners2">圓角</p>
<p>指定背景圖片元素的圓角:</p>
<p id="rcorners3">圓角</p>

如何限制HTML文字框裡的內容不可更改
<input type="text" disabled="disabled" value="你想要顯示的內容">
<input type="text" readonly value="你想要顯示的內容">
兩種方式都可以


去掉<li>標籤的遠點
方法一:
<ul>
<li style="list-style-type:none;">百度</li>
<li style="list-style-type:none;">雅虎</li>
<li style="list-style-type:none;">新浪</li>
<li style="list-style-type:none;">谷歌</li>
</ul>
方法二:
<style>
li {
list-style-type:none;
}
</style>
<ul>
<li>百度</li>
<li>雅虎</li>
<li>新浪</li>
<li>谷歌</li>
</ul>
方法三:
<style>
.aa {
list-style-type:none;
}
</style>
<ul>
<li class="aa">百度</li>
<li class="aa">雅虎</li>
<li class="aa">新浪</li>
<li class="aa">谷歌</li>
</ul>


<input type="submit" value="確定" style="background:green;color:red " />