CSS 对齐方式
2017-03-02 15:05
197 查看
居中设置
The element will then take up the specified width, and the remaining space will be split equally between the two margins:
View Code
Center Align - Using margin
Setting the width of a block-level element will prevent it from stretching out to the edges of its container. Usemargin: auto;, to horizontally center an element within its container.
The element will then take up the specified width, and the remaining space will be split equally between the two margins:
<!DOCTYPE html> <html> <head> <style> .right { position: absolute; right: 0px; width: 300px; border: 3px solid #73AD21; padding: 10px; } </style> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <div class="right"> <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p> </div> </body> </html>
View Code
相关文章推荐
- css控制字间距和对齐方式及其所用属性介绍
- css 对齐方式 分类
- CSS首行缩进 文本对齐方式
- CSS定义文字的对齐方式
- CSS布局(六) 对齐方式
- css基础 vertical-align 设置文字与textarea对齐的方式
- HTML + CSS短标题(二,三,四文字长度)两端对齐的方式
- css水平垂直居中对齐方式
- css text-align-last设置末尾文本对齐方式
- css文本,元素,图像居中对齐方式
- CSS两端对齐方式
- <css 十四>关于css的对齐方式
- css基础 设置所有h1标签的 文本颜色 对齐方式 边框样式 背景颜色
- css-对齐方式进阶案例
- CSS中,display属性、行高属性line-height以及垂直对齐方式vertical-align属性详细探讨
- CSS制作水平垂直居中对齐 多种方式各有千秋
- HTML + CSS短标题(二,三,四文字长度)两端对齐的方式
- CSS控制去掉textArea和input的边框 及其对齐方式
- HTML + CSS短标题(二,三,四文字长度)两端对齐的方式