HTML5中input輸入框默認提示文字向左向右移動
首先演示input輸入框代碼
<style>
* {
margin: 0;
padding: 0;
}
.sousuo {
width: 458px;
height: 34px;
margin-left: 190px;
margin-top: 200px;
border: 2px solid red;
}
</style>
</head>
<body>
<input class="sousuo" type="text" placeholder="請輸入搜索內容...">
</body>
代碼運行界面圖

重要的點來了
可以看到默認提示文字是緊緊靠著左邊框的
我們為了美觀需要把它往后移動 只需要在css中添加代碼
text-indent: 20px;
下面我們看下加入代碼后的運行界面

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/4833.html
標籤:其他
