Flex 布局

Flex布局

一种非常方便的布局方式。 在容器中记住4个样式
display: flex; flex布局 
flex-direction: row; 规定主轴的方向:row/column 
justify-content: space-around; 元素在主轴方向上的排列方式:flex-start/flex- end/space-around/space-between 
align-items: center; 元素在副轴方向上的排列方式:flex-start/flex- end/space-around/space-between

 

<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<title>文档标题</title>
 <style>
      
.menu{
  height:200px;
  display:flex;
  flex-direction:row;
  justify-content: space-between;
  align-items:center
}
.item{
  width:20px;
  height:40px;
  border:solid green;
  background:red;
}
  </style>
</head>
<body>
  <div class="menu">
    <div class="item">
      1
    </div>
      <div class="item">
      2
    </div>
    <div class="item">
      3
    </div>
    <div class="item">
      4
    </div>
  </div>
    
</body>
</html>

 

相关文章

一:display:flex布局display:flex是一种布局方式。它即可以...
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何...
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些...
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周...
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后...
我在网页上运行了一个Flex应用程序,我想使用Command←组合键...