05justify-content

简介: 05justify-content

display: flex; 的默认轴是x轴


justify-content: 设置主轴上的子元素排列的方式


所以在使用之前要确定好哪一个是主轴


/* justify-content:flex-start; 如果主轴是x,从左到右 如果主轴是y,从上到下*/


/* justify-content: flex-end; 如果主轴是y,从下到上到右 如果主轴是x,从右到做*/


/* justify-content:center; 居中*/


/* justify-content: space-around; */


/* justify-content: space-between; */


#main {
    width: 800px;
    height: 300px;
    border: 1px solid #c3c3c3;
    display: flex; 
    flex-direction: row;
    justify-content:flex-start;
}
#main>div{
    width: 150px;
    height: 100px;
    background: #0099FF;
}
<div id="main">
  <div style="background-color:coral;">11</div>
  <div style="background-color:lightblue;">22</div>
  <div style="background-color:pink;">33</div>
  <div style="background-color:olive;">4</div>
</div>


1425695-20191108220312219-1595394512.pngjustify-content:flex-end;


1425695-20191108220510081-286224091.png


justify-content: space-around;


1425695-20191108220559505-851305422.png


相关文章
|
12月前
|
XML JSON 前端开发
详解Http的Content-Type
1.概述 HTTP(HyperText Transfer Protocol),超文本传输协议。超文本(Hypertext)是一种结构化的文本,其中包含了超链接(Hyperlink)的能力,通过超链接可以在不同文档之间创建关联和跳转。 传统的文本是线性的,按照一定的顺序排列的,而超文本则打破了线性结构,允许文本中的某些词、短语或图像与其他文档或资源之间建立关联。这些关联通过超链接来实现,用户可以点击超链接来跳转到其他相关的文档、网页、图片、视频或其他媒体资源。
237 1
|
存储 Android开发
解读ImageView的wrap_content和adjustViewBounds的工作原理
ImageView是android开发过程中经常会使用的一种组件,由于android屏幕碎片化的问题,有时候我们无法设定一个具体的宽高。比如说width是match_parent的,这时候我们还想让图片在宽度完全填充并能正常显示,我们直接会想到将height设置为wrap_content。但是用过的同学都知道ImageView的实际区域要大于图片区域
296 0
|
JSON JavaScript API
axios设置content-type
axios设置content-type
873 0
|
XML JSON JavaScript
二、HTTP Content-Type详解
二、HTTP Content-Type详解
272 1
|
前端开发 Windows
【BootStrap】<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 的说明
【BootStrap】<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 的说明
197 0
【BootStrap】<meta http-equiv="X-UA-Compatible" content="IE=edge" /> 的说明
the content is displayed over another view controller’s content
the content is displayed over another view controller’s content
108 0
the content is displayed over another view controller’s content
|
容器 前端开发
|
Web App开发 前端开发 iOS开发

热门文章

最新文章