欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

如何讓你的html button本身居中的實現(xiàn)

  發(fā)布時間:2020-06-19 16:39:23   作者:葉落森   我要評論
這篇文章主要介紹了如何讓你的html button本身居中的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧

如何讓你的html button本身居中呢? 這個很好找思路, 在其父標簽中設置居中屬性啊, 如下:

<html>
<body>
 
<center><button onClick="myClick()">hit me</button></center>
 
<script>
function myClick()
{
 alert("123");
}
</script>
</body>
</html>

或者:

<html>
<body>
 
<div align="center"><button onClick="myClick()">hit me</button></div>
 
<script>
function myClick()
{
 alert("123");
}
</script>
</body>
</html>

按鈕水平居中

button是一個行內(nèi)塊級元素display:inline-block;

所以處理方式很簡單,可以用以下兩種方式:

方式一:

 <div style="text-align:center">  
 <button>按鈕居中</button>                      
 </div>

方式二:

<div>    
<button  style="display:block;margin:0 auto">按鈕居中</button>                      
</div>

到此這篇關(guān)于如何讓你的html button本身居中的實現(xiàn)的文章就介紹到這了,更多相關(guān)html button居中內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論