美文网首页
15、弹性盒和媒体查询

15、弹性盒和媒体查询

作者: calvinbj | 来源:发表于2019-03-04 22:10 被阅读0次





<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; display: inline-flex;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px;}
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; display: flex; flex-direction: row-reverse;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px;}
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; display: flex; width: 180px; flex-wrap: nowrap;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px; }
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>

下面是justify-content:flex-end例子:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; display: flex; justify-content: flex-end;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px; }
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; overflow: hidden; width: 262px;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px; float: left; margin-right: 18PX;}
        section:last-child {margin-right: 0;}
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        .box{border: 1px #f00 solid; overflow: hidden; width: 262px; display: flex; justify-content: space-between;}
        section{width: 50px; height: 50px; border: 1px #00f solid; text-align: center; line-height: 50px; float: left; margin-right: 18PX;}
    </style>
</head>
<body>
<div class="box">
    <section>1</section>
    <section>2</section>
    <section>3</section>
    <section>4</section>
</div>
</body>
</html>

相关文章

  • 15、弹性盒和媒体查询

    下面是justify-content:flex-end例子:

  • CSS3弹性盒和媒体查询、响应式布局

    关注我的个人博客:https://pinbolei.cn,获取更多内容 一、怪异盒模型的简介 二、弹性盒模型 Fl...

  • 响应式布局小结

    根据维基百科定义:弹性网格布局、弹性图片和媒体查询整合起来,并将其命名为RWD(Responsive Web De...

  • 弹性盒FlexibleBox的相关概念

    一. 弹性盒的定义 弹性盒子由弹性容器(Flex container)和弹性子元素(Flex item)组成。弹性...

  • 响应式布局和弹性盒模型,使用媒体查询和rem布局

    手机有不同的分辨率,不同的屏幕大小,如何使我们开发的应用或页面大小能适合各种高端手机使用,学习viewport能帮...

  • 响应式网页设计

    一、名词解释 响应式Web设计:综合运用弹性网格布局、弹性图片/媒体、媒体查询实现的网页内容会随着视口及设备的不同...

  • 一个HTML+CSS项目

    github 做了简单的弹性布局加媒体查询。还没有支持移动端

  • css弹性盒知识总结

    弹性盒包括: 弹性容器 和 弹性子元素 弹性容器设置display:flex; 然后给弹性容器设置其他的属性 1....

  • CSS3弹性盒子

    弹性盒模型 弹性盒模型是CSS3新增的属性,设置display属性值为flex的元素为弹性盒模型对象。弹性盒子由弹...

  • 弹性盒

    弹性盒-flex布局 弹性盒是css3的一种新的布局模式CSS3弹性换盒,是一种当页面需要适应不同的屏幕大小以及设...

网友评论

      本文标题:15、弹性盒和媒体查询

      本文链接:https://www.haomeiwen.com/subject/yhibuqtx.html