I am trying to display a div of sections inside of a grid layout but unfortunately the sections only display as block. I am hoping someone will be able to tell me how to display the second portion of the data flexed, currently when I try to select the div inside of Class locationInfo as display flex it does nothing at all.
I want it to look like
but currently it looks like the following
here is my component
<template>
<div id="mainDiv">
<div id="locationInfo">
<!-- left detail section -->
<div>
<section>
<p><b>NYC</b></p>
<small>7:35</small>
</section>
<section>
<img src='../assets/svg/flight.svg' height="40px" width="40px"/>
<small>10/12/20</small>
</section>
<section>
<p><b>SYD</b></p>
<small>10:45</small>
</section>
<div id="AirlinesDetails">
<img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
<section>
<b><p>Turkish Airlines</p></b>
<small>cx511 | Airbus 333</small>
</section>
<section>
<p>2 Stop</p>
<small>3h 58min</small>
</section>
</div>
</div>
<!-- second row-->
<div>
<section>
<h4>NYC</h4>
<small>7:35</small>
</section>
<section>
<img src='../assets/svg/flight.svg' height="40px" width="40px"/>
<small>10/19/20</small>
</section>
<section>
<h4>SYD</h4>
<small>10:35</small>
</section>
<div id="AirlinesDetails">
<img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
<section>
<b><p>Turkish Airlines</p></b>
<small>cx511 | Airbus 333</small>
</section>
<section>
<p>2 Stop</p>
<small>3h 58min</small>
</section>
</div>
</div>
</div>
</div>
</div>
</template>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#modal-1{
border: none;
color: black;
}
#modal-1 div{
border: none;
padding-right: 1em;
}
#modalInputdiv1{
margin-top: 1em;
display: flex;
justify-content: left;
}
#modalInputdiv1 div{
border: 1px solid rgba(128, 128, 128, 0.349);
border-radius: 5px;
}
#modalInputdiv1 input{
width: 40%;
height: 2.5em;
border-radius: 5px;
margin-right: 1em;
margin-top: .5em;
border: 1px solid rgba(128, 128, 128, 0.349);
}
#modalInputdiv1 input::placeholder{
padding-left: .5em;
color: black;
}
#modalInputdiv2{
display: flex;
justify-content: left;
margin-top: 1em;
margin-bottom: 1em;
padding-left: .5em;
padding-bottom: .5em;
}
#modalInputdiv2 input::placeholder{
padding-left: .5em;
color: black;
}
#modalInputdiv2 div{
border-radius: 5px;
padding-left: .5em;
border: 1px solid rgba(128, 128, 128, 0.349);
}
#modalInputdiv3{
display: flex;
justify-content: left;
border: 1px solid rgba(128, 128, 128, 0.349);
padding-left: .5em;
}
#modalInputdiv3 div{
width: 50%;
border-radius: 5px;
padding:.5em;
margin-right: 1em;
border: 1px solid rgba(128, 128, 128, 0.349);
}
#modalSaveDiv{
margin-top: 3em;
display: flex;
justify-content: center;
width: 100%;
}
#modalsaveBtn{
background-color:#2E9CFF;
color: white;
border: none;
border-radius: 10px;
height: 40px;
width: 90%;
}
#dob{
border: 1px solid rgba(128, 128, 128, 0.349);
width: 50%;
}
.modalImg{
height: 15px;
width: 15px;
}
#modalInputdiv2 input{
width: 30%;
border-radius: 5px;
margin-right: 1em;
margin-top: .5em;
border: 1px solid rgba(128, 128, 128, 0.349);
}
.modaldivs{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 40%;
height: 2.5em;
margin-top: .5em;
border: 1px solid rgba(128, 128, 128, 0.349);
border-radius: 5px;
}
#modalInputdiv2 p{
margin-top: .5em;
padding: 0 .5em 0 .5em;
}
#modalInputdiv2 img{
margin-top: .5em;
}
.blocked{
display: block;
}
.blockedflex *{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.flexed{
display: flex;
}
.toggleSectionActive{
color: #288EF9;
border-bottom: 1px solid #51D79D;
}
#toggleSections{
background-color: white;
}
#sideBarDiv{
justify-content: center;
padding:.5em;
display: block;
background-image: linear-gradient(#0a78f5, #59B0FF);
border-radius: 5px;
box-shadow: 0 1px 2px #88888877;
}
#flyexlogo {
margin-right:1em;
}
#sideBarDiv div{
justify-content: center;
width: 100%;
}
.sideBarDivicons{
display: block;
margin: 0 auto;
margin-top: 2em;
}
#mainDiv{
font-family: 'Noto Sans JP', sans-serif;
color: rgb(73, 79, 90);
width: 100%;
justify-content: center;
margin: 0 auto;
background-color:#F8F8FF;
border-radius: 10px;
}
#bodyGrid{
margin: 1em;
display: grid;
grid-template-columns: 4% 60% 30%;
}
#middleCol div{
margin: .5em;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
#middleCol section{
text-align: left;
margin: 1em 1.5em 1em 1.5em;
}
#middleCol section small{
font-weight: 600;
color: #BCC0C7;
}
#middleCol section h5:hover{
color: #288EF9;
}
#detailsDiv{
padding-bottom: 1em;
border-bottom: 1px solid rgba(128, 128, 128, 0.158);
}
#detailsDiv div{
background-color: white;
border-bottom: 1px solid rgba(128, 128, 128, 0.384);
}
.detailsDivHeaderSection{
display: flex;
justify-content: space-between;
margin-left:3em;
}
.detailsDivHeaderSection p{
margin-left:1em;
margin-right:2em;
}
#leftTripDetails{
display: flex;
justify-content: space-between;
}
#change{
color: #288EF9;
}
#locationInfo{
display: grid;
grid-template-columns: 30% 30%;
grid-template-rows: 50% 50%;
background-color: white;
}
#locationInfo div{
width: 45%;
display: flex;
}
#locationInfo div img{
height: 40px;
width: 40px;
display: block;
}
#locationInfo small{
color:rgb(54, 54, 54);
}
#AirlinesDetails{
width: 100%;
border-bottom: 1px solid rgba(128, 128, 128, 0.158);
background-color: white;
}
#AirlinesDetails img{
margin-left: 1em;
width: 35px;
height: 35px;
}
#departureandreturnDiv{
padding: .5em 0 0 .5em;
border-bottom: 1px solid rgba(128, 128, 128, 0.158);
background-color: white;
}
#departureandreturnDiv p{
padding-right: 2.5em;
margin-right: 2em;
color: #BCC0C7;
font-weight: 500;
}
#departureandreturnDiv p:hover{
color: #288EF9;
border-bottom: 2px solid #51D79D;
}
</style>
Have a look at this possible solution with flex and see if it helps.
<div class="flight-container">
<section class="flight">
<div class="flight-info">
<div>
<h4>NYC</h4>
<p><small>7:35</small><p>
</div>
<div>
<img src='../assets/svg/flight.svg' height="40px" width="40px"/>
<p><small>10/19/20</small></p>
</div>
<div>
<h4>SYD</h4>
<p><small>10:35</small></p>
</div>
</div>
<div class="flight-info">
<div>
<div class="row">
<div>
<img src="../assets/svg/home/logo-2.svg" height="40px" width="40px" />
</div>
<div>
<strong>Turkish Airlines</strong></b>
<p><small>cx511 | Airbus 333</small><p>
</div>
</div>
</div>
<div>
<h4>2 Stop</h4>
<p><small>3h 58min</small></p>
</div>
</div>
</section>
<section class="flight">.....</section>
</div>
CSS
.flight-container{
display: flex;
}
.flight{
width: 50%;
}
.flight-info{
display: flex;
justify-content: space-between;
}
.row{
display:flex;
}
Related
Fairly new to HTML and coding..
I'm having trouble with a box that needs to display 8 items within it as 2 rows:
I have 8 divs (class="item_css") within a div(class="example_box"), how do I display the 8 items in 2 rows, so it shows a row of 4 and then another 4.
I want to avoid using the 'rows' class. What would be the best way to do this?
CSS
* {
margin: 0;
padding: 0;
}
.body_background {
background-color: bisque;
}
.example_banner {
background-color: rgb(247, 245, 245);
height: auto;
width: 100%;
margin: 3% auto;
padding: 4% 0%;
box-shadow: 0px 2px 5px #cccccc;
}
.example_banner_label {
text-align: center;
margin: 2px auto 25px;
}
.example_banner_heading {
font-size: 30px;
text-align: center;
margin: 0% auto;
color: rgb(7 29 148);
text-shadow: 1px 1px #c7c7c7;
}
.example_banner_box {
width: 90%;
height: auto;
margin: 0% auto;
padding: 0%;
}
.example_banner_frame {
display: flex;
position: relative;
height: auto;
width: 1200px;
margin: 0% auto;
padding: 0px;
text-align: center;
background-color: #ffffff;
border: 1px solid #b7b7b7;
}
.example_banner_frame_maincontents {
width: 300px;
height: 450px;
}
div.example_consumer_banner {
width: 300px;
height: 60px;
padding: 10px;
font-size: 25px;
margin: 0%;
text-align: center;
color: white;
background-color: #193cad;
}
.example_consumer_img_label {
width: 20%;
position: absolute;
top: 25%;
left: 10%;
transform: translate(-50%, -50%);
font-size: 25px;
font-family: "Montserrat", sans-serif;
text-align: center;
color: rgb(255 255 255);
text-decoration: none;
text-shadow: -3px 4px 3px rgb(0 0 0);
}
.example_box {
width: 75%;
height: 450px;
background-color: #00b6f3;
}
.item_css {
width: 25%;
height: 150px;
margin: 0%;
padding: 3px;
}
HTML
<section class="main_body">
<div class="body_background">
<div class="row" id="merch_rows">
<div class="example_banner">
<div class="example_banner_frame">
<div class="example_banner_frame_maincontents">
<div class="example_consumer_banner" for="">Lorem ipsum</div>
<img src="" class="example_consumer_picture">
<label class="example_consumer_img_label" for="example_consumer_picture">Lorem ipsum dolor sit amet consectetur </label>
</div>
<div class="example_box">
<div class="item_css" style="color: red; border: 1px solid grey;">1
</div>
<div class="item_css" style="color: orange;border: 1px solid grey;">2
</div>
<div class="item_css" style="color: green;border: 1px solid grey;">3
</div>
<div class="item_css" style="color: yellow;border: 1px solid grey;">4
</div>
<div class="item_css" style="color: blue;border: 1px solid grey;">5
</div>
<div class="item_css" style="color: black;border: 1px solid grey;">6
</div>
<div class="item_css" style="color: grey;border: 1px solid grey;">7
</div>
<div class="item_css" style="color: pink;border: 1px solid grey;">8
</div>
</div>
</div>
</div>
</div>
</section>
Just a simple example on flexbox:
.example_box {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.item_css {
width: 24%;
margin-bottom: 10px;
}
or grid:
.example_box {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 10px;
}
Flexbox would do this.
https://jsfiddle.net/za678wcL/
<div class="container">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
.container {
display: flex;
flex-wrap: wrap;
}
.box {
background-color: green;
height: 50px;
width: calc(25% - 20px);
margin: 10px;
}
I have tried using flexbox to center a couple buttons and a p but I'm having some troubles.
I have this code
.container {
background: rgb(255, 126, 50, 0.15);
padding: 0 2rem;
border-radius: 0.375rem;
margin: 3.625rem 1.25rem 2rem 1.25rem;
background: black;
}
.layout {
height: calc(100vh - 4.5rem);
background: balck;
}
.loginSection {
width: 50vh;
margin: 0 auto;
border: 1px solid #ffffff;
}
.loginSection p {
display: flex;
align-items: center;
margin: 16px 0;
text-align: center;
width: 12rem;
border: 1px solid #ffffff;
}
.btn-login {
height: 1.25rem;
display: flex;
color: rgba(255, 255, 255, 0.54);
text-decoration: none;
align-items: center;
width: 12rem;
margin: 0 auto;
border: 1px solid #ffffff;
padding: 1rem 1.25rem;
line-height: 1rem;
border-radius: 0.375rem;
font-size: 1rem;
}
.btn-login img {
margin-right: 1rem;
}
.btn-continue {
height: 1.25rem;
display: flex;
color: rgba(255, 255, 255, 0.54);
text-decoration: none;
align-items: center;
width: 12rem;
margin: 0 auto;
border: 1px solid #ffffff;
padding: 1rem 1.25rem;
line-height: 1rem;
border-radius: 0.375rem;
font-size: 1rem;
}
<div class="layout">
<div class="container">
<div class="loginSection">
<button class="btn-login" href="/login">
Log-In
</button>
<p>Enter your email</p>
<button class="btn-continue" href="/home">Continue</button>
</div>
</div>
</div>
But I can center the p
| | Log-In | |
|Enter your email |
| | Continue | |
.container {
background: rgb(255, 126, 50, 0.15);
padding: 0 2rem;
border-radius: 0.375rem;
margin: 3.625rem 1.25rem 2rem 1.25rem;
background: black;
}
.layout {
height: calc(100vh - 4.5rem);
background: balck;
}
.loginSection {
width: 50vh;
margin: 0 auto;
border: 1px solid #ffffff;
}
.layout p {
text-align: center;
width: 12rem;
border: 1px solid #ffffff;
color: white;
margin: auto;
}
.btn-login {
height: 1.25rem;
display: flex;
color: rgba(255, 255, 255, 0.54);
text-decoration: none;
align-items: center;
width: 12rem;
margin: 0 auto;
border: 1px solid #ffffff;
padding: 1rem 1.25rem;
line-height: 1rem;
border-radius: 0.375rem;
font-size: 1rem;
}
.btn-login img {
margin-right: 1rem;
}
.btn-continue {
height: 1.25rem;
display: flex;
color: rgba(255, 255, 255, 0.54);
text-decoration: none;
align-items: center;
width: 12rem;
margin: 0 auto;
border: 1px solid #ffffff;
padding: 1rem 1.25rem;
line-height: 1rem;
border-radius: 0.375rem;
font-size: 1rem;
}
<div class="layout">
<div class="container">
<div class="loginSection">
<button class="btn-login" href="/login">
Log-In
</button>
<p>Enter your email</p>
<button class="btn-continue" href="/home">Continue</button>
</div>
</div>
</div>
Flexbox is typically used by setting flex properties on the parent container to affect the layout of the children inside of that container.
It looks like you're adding display: flex and align-items: center on the .loginSection p element, when flex properties should be set on the parent .loginSection.
If your intention is to center all the elements inside of the .loginSection horizontally, then you can get rid of the flex properties on the children, and add the following rules:
.loginSection {
display: flex;
flex-direction: column;
justify-content: center;
// ... other styles here
}
You'll want to add display:flex with flex-direction: column and align-items:center to the .loginSection container.
Typically when using flex, you flex the container and then the children become "flex-items" rather than flexing the items themselves.
.loginSection {
margin: 0 auto;
display: flex;
flex-direction: column;
align-items:center;
}
.loginSection p { text-align:center; }
<div class="layout">
<div class="container">
<div class="loginSection">
<button class="btn-login" href="/login">
Log-In
</button>
<p>Enter your email</p>
<button class="btn-continue" href="/home">Continue</button>
</div>
</div>
</div>
Or if you want them to all be stretched out use align-items:stretch
.loginSection {
margin: 0 auto;
padding: 1rem; /* optional if you don't want it to stretch the whole width */
display: flex;
flex-direction: column;
align-items:stretch;
}
.loginSection p { text-align:center; }
<div class="layout">
<div class="container">
<div class="loginSection">
<button class="btn-login" href="/login">
Log-In
</button>
<p>Enter your email</p>
<button class="btn-continue" href="/home">Continue</button>
</div>
</div>
</div>
The flex given in the first div should have re sized the contents to fit the size. This behavior is correct in Chrome. Where as Edge does not behave in the same manner. I have read some posts mention flexbox does not work well with border-box. But in that case Chrome should have also behaved in the same manner as Edge.
#notificationNameAnnex
{
height: 35px;
display: flex;
flex-direction: row;
width: calc(100% - 116px);
}
#markAsNotificationButtons
{
font-size: 11px;
background-color: #30b4f4;
border: 1px solid #1a99d6;
height: 20px;
padding: 2px;
line-height: 16px;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
margin-left: 5px;
cursor: pointer;
border-radius: 5px;
color:white;
}
*
{
box-sizing: border-box;
}
.outerdiv
{
width: 440px;
height: 80px;
overflow: hidden;
border: 1px solid red;
background-color: #f9f3ff;
top: 0px;
font-family: roboto;
letter-spacing: 0.75px;
display: flex;
flex-direction: column;
}
.innerdiv
{
width: 400px;
height: 65px;
position: relative;
padding: 6px;
padding-top: 3px;
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: #e5dbfd;
font-size: 10px;
color: #490181;
border: 1px solid #d3c7ef;
border-radius: 3px;
margin: auto;
text-align: center;
margin-top: 2px;
}
<!DOCTYPE html>
<html>
<head>
<style>
#notificationNameAnnex
{
height: 35px;
display: flex;
flex-direction: row;
width: calc(100% - 116px);
}
#markAsNotificationButtons
{
font-size: 11px;
background-color: #30b4f4;
border: 1px solid #1a99d6;
height: 20px;
padding: 2px;
line-height: 16px;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
margin-left: 5px;
cursor: pointer;
border-radius: 5px;
color:white;
}
*
{
box-sizing: border-box;
}
.outerdiv
{
width: 440px;
height: 80px;
overflow: hidden;
border: 1px solid red;
background-color: #f9f3ff;
top: 0px;
font-family: roboto;
letter-spacing: 0.75px;
display: flex;
flex-direction: column;
}
.innerdiv
{
width: 400px;
height: 65px;
position: relative;
padding: 6px;
padding-top: 3px;
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: #e5dbfd;
font-size: 10px;
color: #490181;
border: 1px solid #d3c7ef;
border-radius: 3px;
margin: auto;
text-align: center;
margin-top: 2px;
}
</style>
</head>
<body>
<div class="outerdiv">
<div class="innerdiv" >
<div style="position: absolute;z-index: 1;right: 5px;color: #9683bd;cursor: pointer;top:-5px;font-size:12px;" title="Close" >⨯</div>
<div style="line-height: 12px;font-size: 10px;color:#490181;margin: auto;width: 360px;">
This div is bigger (width is also 300px and height is 100px)This div is bigger (width is also 300px and height is 100px)
</div>
<div style="display: flex;margin-top: 5px; ">
<div style="width: 116px;font-size: 10px;font-weight:medium;height: 20px;">Give a name for feed</div>
<div id="notificationNameAnnex">
<div style="display: flex;flex-direction: column;width: 210px;">
<input type="text" placeholder="Give feed name" style="margin-bottom: 0;font-size: 11px;"/>
</div>
<div id="markAsNotificationButtons">
<div>Confirm</div>
</div>
</div>
</div>
</div>
<div style="font-size: 10px; color: #818181; margin: auto; line-height: 20px; display: block;">
Note: This div is bigger (width is also 300px and height is 100px).
</div>
</div>
</div>
</body>
</html>
Flex item's by default won't be smaller than its content, as its min-height defaults to auto.
Chrome still shrink your sample, Firefox/Edge does not, and IMHO, it is Chrome that is wrong here.
The innerdiv is 65px high + 2px top margin, and its sibling, the bottom div, is about 20px (line-height), which make them about 87px high, and won't of course fit in its parent being 80px.
By adding min-height: 0 to innerdiv solves the problem cross browser, allowing it to shrink.
Stack snippet
#notificationNameAnnex {
height: 35px;
display: flex;
flex-direction: row;
width: calc(100% - 116px);
}
#markAsNotificationButtons {
font-size: 11px;
background-color: #30b4f4;
border: 1px solid #1a99d6;
height: 20px;
padding: 2px;
line-height: 16px;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
margin-left: 5px;
cursor: pointer;
border-radius: 5px;
color: white;
}
* {
box-sizing: border-box;
}
.outerdiv {
width: 440px;
height: 80px;
overflow: hidden;
border: 1px solid red;
background-color: #f9f3ff;
top: 0px;
font-family: roboto;
letter-spacing: 0.75px;
display: flex;
flex-direction: column;
}
.innerdiv {
width: 400px;
height: 65px;
position: relative;
padding: 6px;
padding-top: 3px;
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: #e5dbfd;
font-size: 10px;
color: #490181;
border: 1px solid #d3c7ef;
border-radius: 3px;
margin: auto;
text-align: center;
margin-top: 2px;
min-height: 0; /* added */
}
<div class="outerdiv">
<div class="innerdiv">
<div style="position: absolute;z-index: 1;right: 5px;color: #9683bd;cursor: pointer;top:-5px;font-size:12px;" title="Close">⨯</div>
<div style="line-height: 12px;font-size: 10px;color:#490181;margin: auto;width: 360px;">
This div is bigger (width is also 300px and height is 100px)This div is bigger (width is also 300px and height is 100px)
</div>
<div style="display: flex;margin-top: 5px; ">
<div style="width: 116px;font-size: 10px;font-weight:medium;height: 20px;">Give a name for feed</div>
<div id="notificationNameAnnex">
<div style="display: flex;flex-direction: column;width: 210px;">
<input type="text" placeholder="Give feed name" style="margin-bottom: 0;font-size: 11px;" />
</div>
<div id="markAsNotificationButtons">
<div>Confirm</div>
</div>
</div>
</div>
</div>
<div style="font-size: 10px; color: #818181; margin: auto; line-height: 20px; display: block;">
Note: This div is bigger (width is also 300px and height is 100px).
</div>
</div>
I have three flexbox containers (header, .content__description and footer) and two of them (header and .content__description) don't fit the children's height in Chrome, but only in Firefox. Therefore, the first container is covered by the second one. Why does it occur?
/* util.css */
.break {
width: 100%;
}
/* An issue
html,
body {
height: 100%;
}
*/
/* The solution I found */
html {
height: 100%;
}
body {
min-height: 100%;
}
/* Other styles */
body {
display: flex;
flex-direction: column;
justify-content: space-between;
color: rgb(255, 255, 255);
background-color: rgb(20, 142, 210);
}
header {
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
margin-top: 3em;
margin-bottom: 3em;
}
.header__logo {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding-bottom: 1em;
}
.header__logo img {
width: 3em;
height: 3.3em;
margin-right: 0.6em;
}
.header__logo span {
font-size: 5em;
font-weight: 400;
}
.header__slogan {
font-size: 1.5em;
font-weight: 400;
text-align: center;
}
.content {
margin-left: auto;
margin-right: auto;
}
.content__description {
display: flex;
flex-direction: column;
padding-top: 3em;
padding-bottom: 3em;
background-color: rgb(0, 114, 174);
position: relative;
}
.content__description__signin {
position: absolute;
text-decoration: none;
text-align: center;
color: black;
background-color: rgb(254, 190, 0);
box-sizing: border-box;
font-size: 2em;
border: 0.2em rgb(255, 255, 255) solid;
line-height: 1em;
width: 6em;
padding: 0.2em;
top: calc(100% - 0.9em);
left: calc(50% - 3em);
}
.content__description__signin:hover {
background-color: rgb(241, 177, 0);
}
.content__description__strep {
width: 13em;
text-align: center;
font-size: 2em;
box-sizing: border-box;
}
.content__description__strep img {
width: 5em;
height: 5em;
border: 0.2em rgb(255, 255, 255) solid;
border-radius: 50%;
box-shadow: 0.2em 0.5em 1em rgba(0, 0, 0, 0.3);
box-sizing: border-box;
margin-bottom: 1em;
}
.content__description__strep figcaption {
background-color: rgb(2, 98, 148);
padding: 1em;
margin-left: -1em;
margin-right: -1em;
}
footer {
flex-grow: 1;
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
min-height: 1.8em;
}
<body>
<header>
<div class="header__logo">
<img src="images/logo.svg" alt="logo">
<span>Sailing</span>
</div>
<span class="break"></span>
<h1 class="header__slogan">You can!</h1>
</header>
<div class="content">
<div class="content__description">
<figure class="content__description__strep">
<img src="images/meeting.jpg" alt="meeting">
<figcaption>Talking</figcaption>
</figure>
<figure class="content__description__strep">
<img src="images/sailing.jpg" alt="sailing">
<figcaption>Sailing</figcaption>
</figure>
<figure class="content__description__strep">
<img src="images/cinema.jpg" alt="cinema">
<figcaption>Watching</figcaption>
</figure>
Sign in
</div>
</div>
<footer> </footer>
</body>
EDIT #1
The display style of .content__description is changed to "flex" (misprint).
EDIT #2
I've found the solution - switched body {height: 100%} to body {min-height: 100%}. It works perfectly for me.
I need to place a picture in a box on the right of the sidebar. div-box has certain size and border.
If i set the style to a picture, it enlarges to the size of the box, when i need it to be 100%.
If i set the style to a box, the box' borders expand to a sidebar.
Please advise.
.sidebar {
background: white;
height: 240px;
width: 240px;
float: left;
padding: 40px 46px 46px 46px;
}
.sidebar-button{
display: block;
height: 28px;
width: 240px;
border-top: #c8c8c8 1px solid;
border-right: #c8c8c8 1px solid;
border-left: #c8c8c8 1px solid;
padding-left: 20px;
text-decoration: none;
font-size: 15px;
color: gray;
padding-top: 12px;
}
.auto {
border-bottom: #c8c8c8 1px solid;
}
.sidebar-button:hover{
background-color: #f9f9f9;
color: black;
padding-left: 40px;
width: 220px;
}
.bike-picture {
border: #c8c8c8 1px solid;
margin: 40px 46px 46px 26px;
width: auto;
height: 400px;
padding-top: 40px;
text-align: center;
}
<div class="sidebar">
<a class="sidebar-button" href="#">Ноутбуки</a>
<a class="sidebar-button" href="#">Планшеты</a>
<a class="sidebar-button" href="#">Телефоны</a>
<a class="sidebar-button" href="#">Телевизоры</a>
<a class="sidebar-button" href="#">Бытовая техника</a>
<a class="sidebar-button auto" href="#">Автотовары</a>
</div>
<div class="bike-picture">
<img src="img/bike.png" alt="Bike">
</div>
enter image description here
check this one:
.container{
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row nowrap; /* Safari 6.1+ */
flex-flow: row nowrap;
-webkit-align-items: flex-start; /* Safari 7.0+ */
align-items: flex-start;
padding: 40px 0 46px 0;
background-color: white;
}
.sidebar {
height: 240px;
flex-basis: 240px;
padding: 0 46px 0 46px;
}
.sidebar-button{
display: block;
height: 28px;
width: 240px;
border-top: #c8c8c8 1px solid;
border-right: #c8c8c8 1px solid;
border-left: #c8c8c8 1px solid;
padding-left: 20px;
text-decoration: none;
font-size: 15px;
color: gray;
padding-top: 12px;
}
.auto {
border-bottom: #c8c8c8 1px solid;
}
.sidebar-button:hover{
background-color: #f9f9f9;
color: black;
padding-left: 40px;
width: 220px;
}
.bike-picture {
border: #c8c8c8 1px solid;
flex-grow: 1;
text-align: center;
}
.bike-picture img{
max-width: 100%;
}
<div class="container">
<div class="sidebar">
<a class="sidebar-button" href="#">Ноутбуки</a>
<a class="sidebar-button" href="#">Планшеты</a>
<a class="sidebar-button" href="#">Телефоны</a>
<a class="sidebar-button" href="#">Телевизоры</a>
<a class="sidebar-button" href="#">Бытовая техника</a>
<a class="sidebar-button auto" href="#">Автотовары</a>
</div>
<div class="bike-picture">
<img src="http://s12.postimg.org/fpyql332l/felt_bicycles_q26_194648_1.jpg" alt="Bike">
</div>
</div>