大佬教程收集整理的这篇文章主要介绍了CSS:我不能在DIV元素的中间放一个按钮,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html
我需要在DIV的中间放一个按钮,以便集中.但我不能!
这是按钮的代码:
<a class="button" href="#"><span>Bring world peace</span></a>
这里的CSS:
.clear { /* generic container (i.e. div) for floaTing buttons */ overflow: hidden; width: 100%; } a.button { BACkground: transparent url('bg_button_a.gif') no-repeat scroll top right; color: #444; display: block; float: left; font: normal 12px arial,sans-serif; height: 24px; margin-right: 6px; padding-right: 18px; /* sliding doors padding */ text-decoration: none; } a.button span { BACkground: transparent url('bg_button_span.gif') no-repeat; display: block; line-height: 14px; padding: 5px 0 5px 18px; }
<div align="center"><a class="button" href="#"><span>Bring world peace</span></a></div>
<div class="centerize"> <a class="button" href="#"><span>Bring world peace</span></a> </div>
和CSS:
.centerize { text-align: center; }
请注意,设置text-align将仅影响div内的内容. div本身(应该是)块元素,并且取决于它位于文档结构中的位置,可能不会居中.
只要多一点确定,你可以这样做:
.centerize { display: block; margin: 0 auto; text-align: center; }
现在,您可以将centerize应用于任何元素,该元素应占用整个浏览器的宽度并对齐其内容.
以上是大佬教程为你收集整理的CSS:我不能在DIV元素的中间放一个按钮全部内容,希望文章能够帮你解决CSS:我不能在DIV元素的中间放一个按钮所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。