短视频,自媒体,达人种草一站服务
这篇文章主要介绍了如何让你的html button本身居中的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
如何让你的html button本身居中呢? 这个很好找思路, 在其父标签中设置居中属性啊, 如下:
<html>
<body>
<center><button>hit me</button></center>
<script>
function myClick()
{
alert("123");
}
</script>
</body>
</html>
或者:
<html>
<body>
<div><button>hit me</button></div>
<script>
function myClick()
{
alert("123");
}
</script>
</body>
</html>
#FormatStrongID_0#
button是一个行内块级元素display:inline-block;
所以处理方式很简单,可以用以下两种方式:
方式一:
<div>
<button>按钮居中</button>
</div>
方式二:
<div>
<button >按钮居中</button>
</div>
到此这篇关于如何让你的html button本身居中的实现的文章就介绍到这了,更多相关html button居中内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!