CSS3中左浮动用什么属性,用法是怎样
Admin 2022-05-24 群英技术资讯 850 次浏览
在css中,可以使用“float:left”来表示左浮动,float属性用于定义元素向哪个方向浮动,当属性值为right时表示元素右浮动,当属性值为none时表示元素不浮动。
本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。
css3使用什么属性表示左浮动
float 属性定义元素在哪个方向浮动。以往这个属性总应用于图像,使文本围绕在图像周围,不过在 CSS 中,任何元素都可以浮动。浮动元素会生成一个块级框,而不论它本身是何种元素。
如果浮动非替换元素,则要指定一个明确的宽度;否则,它们会尽可能地窄。
注释:假如在一行之上只有极少的空间可供浮动元素,那么这个元素会跳至下一行,这个过程会持续到某一行拥有足够的空间为止。
left 元素向左浮动。
right 元素向右浮动。
none 默认值。元素不浮动,并会显示在其在文本中出现的位置。
inherit 规定应该从父元素继承 float 属性的值。
示例如下:
<html> <head> <style type="text/css"> img { float:left } </style> </head> <body> <p>在下面的段落中,我们添加了一个样式为 <b>float:left</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>
输出结果:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
本篇文章主要为大家讲述的技术关于draggable属性实现页面拖动的效果,往下读下去,一步步的你会发现这个其实也不是很难,现在让我们一起来看这篇文章吧
方法:1、用“@keyframes 名称{99%{opacity:1;}100%{opacity:0;}}”语句设置元素消失动画;2、用“元素{animation-duration:时间}”语句设置动画元素的动画时间,时间过后元素就会消失。
这篇文章主要介绍了解决HTML5中滚动到底部的事件问题,需要的朋友可以参考下
CSS的calc函数用法是什么,如何应用实现布局?下文有详细的介绍,小编觉得挺实用的,对大家学习或工作或许有帮助,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
本文给大家分享在css中用outline-offset实现加号动画效果,也就是黑色边框缩小变成加号的动画,具体的实现效果及代码如下,感兴趣的朋友可以了解看看。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008