Padding a flex item - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Item

Description

Padding a flex item

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

body > div {
   height: 50px;
   display: flex;
}
body > div > div {
   flex: 1;<!--   ww w. j av  a 2  s  . c om-->
   box-sizing: border-box;
}
#a {
   background-color: red;
}
#b {
   background-color: green;
}
#c {
   padding: 10px;
   background-color: blue;
}
#d {
   background-color: yellow;


      </style> 
 </head> 
 <body> 
  <div> 
   <div id="a"></div> 
   <div id="b"></div> 
  </div> 
  <div> 
   <div id="c"></div> 
   <div id="d"></div> 
  </div>  
 </body>
</html>

Related Tutorials