css设置右对齐的方法:1、通过使用cssposition属性来实现右对齐效果;2、通过float属性实现右对齐效果;3、通过text-align属性实现右对齐效果。
本文操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
通过css设置右对齐方法详解:
1、通过css的position属性实现右对齐
右对齐登录后复制以下实例演示了如何使用 position 来实现右对齐:
元素右对齐
css代码:.right { position: absolute; right: 0px; width: 300px; border: 3px solid #73AD21; padding: 10px;}
效果图:
2、通过float属性实现右对齐
登录后复制在下面的段落中,我们添加了一个样式为 float:right 的图像。结果是这个图像会浮动到段落的右侧。
This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.
效果图:
3、通过text-align属性实现右对齐
登录后复制这是标题 1
这是标题 2这是标题 3
效果图:
【推荐学习:css视频教程】
以上就是css怎么设置右对齐的详细内容,更多请关注易企推科技其它相关文章!
本文地址:网络百科频道 https://www.eeeoo.cn/wangluo/1147791.html,嗨游网一个专业手游免费下载攻略知识分享平台,本站部分内容来自网络分享,不对内容负责,如有涉及到您的权益,请联系我们删除,谢谢!