大佬教程收集整理的这篇文章主要介绍了CSS固定位置带自动边距,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#content { width: 1200px; height:auto !important; height:100%; min-height:100%; padding-top: 42px; padding-bottom: 100px; margin-auto: 0 auto; position: relative; } #left { width: 700px; float: left; } #right { width: 500px; position: fixed; top: 0px; }
#CSS-SELECTOR-YOU-ARE-USING{ BACkground:#FF0000; // Just so you can see whats going on position:fixed; // Position the element right:50%; // Move it to the right for 50% of parent element margin-right:-250px; // You need here to put 1/2 of what you have below in width width:500px; }
这样,您将元素向右移动50%,然后将其移动到其一半宽度.这样你就可以得到位置中心的元素:fixed.
以上是大佬教程为你收集整理的CSS固定位置带自动边距全部内容,希望文章能够帮你解决CSS固定位置带自动边距所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。