百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>CSS教程> css想让块靠右该怎样实现
分享文章到:

css想让块靠右该怎样实现

发布时间:12/01 来源:未知 浏览: 关键词:

css想让块靠右的实现办法:可以通过float属性来实现,如【float:right;】,表示元素向右浮动。float属性用于定义元素在哪个标的目的浮动,left表示元素向左浮动,right表示元素向右浮动。

本文环境:

  • windows10、css3

  • 本文适用于所有品牌的电脑

相关元素:

float 属性定义元素在哪个标的目的浮动。以往这个属性总利用于图像,使文本环绕在图像四周,不外在 CSS 中,任何元素都可以浮动。浮动元素会生成一个块级框,而不管它本身是何种元素。

(学习视频分享:css视频教程)

属性值:

  • left 元素向左浮动。

  • right 元素向右浮动。

  • none 默许值。元素不浮动,并会显示在其在文本中显现的位置。

  • inherit 规定应当从父元素继承 float 属性的值。

代码实现:

<html>
<head>
<style type="text/css">
img 
{
float:right
}
</style>
</head>

<body>
<p>鄙人面的段落中,我们增加了一个样式为 <b>float:right</b> 的图像。结果是这个图像会浮动到段落的右侧。</p>
<p>
<img src="/i/eg_cute.gif" />
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.
</p>
</body>

</html>

实现结果:

43c7e9871412d28526b2c5b45a4941a.png

相关引荐:CSS教程

以上就是css想让块靠右该怎样实现的具体内容,更多请关注百分百源码网其它相关文章!

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有152人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板