Wrap text inside content border - html

For my project, I need to create this filter list. I succeeded in doing almost everything, but I have a small problem.
The border of my item list don't wrap my text content. I tried to resolve it by using overflow:auto and flex-flow: row wrap, but it don't work out.
Here is my code:
#filter-content{
display: flex;
flex-direction: row;
flex-flow: row wrap;
padding: 16px 0px 0px 16px;
}
#filter-nav{
display: flex;
flex-direction: row;
list-style: none;
}
.filter-item{
color: black;
font-family: Raleway;
font-size: 14px;
font-weight: bold;
height: 20px;
width: 100px;
line-height: 20px;
text-align: center;
margin-top: 5px;
margin-right: 30px;
border: 2px solid #F2F2F2;
border-radius: 10px;
cursor: pointer;
}
.filter-item:hover{
transform: scale(1.1);
background-color: #DEEBFF;
}
#money-icon{
position: relative;
right: 12px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#dog-icon{
position: relative;
right: 25px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#heart-icon{
position: relative;
right: 9px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#person-icon{
position: relative;
right: 15px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<script src="https://kit.fontawesome.com/1f544e41e8.js" crossorigin="anonymous"></script>
<div id="filter-content">
<h3>Filters</h3>
<ul id="filter-nav">
<li class="filter-item"><i id="money-icon" class="fa-solid fa-money-bill-wave"></i>Low cost</li>
<li class="filter-item"><i id="person-icon" class="fa-solid fa-child-reaching"></i>Family-friendly</li>
<li class="filter-item"><i id="heart-icon" class="fa-solid fa-heart"></i>Romantic</li>
<li class="filter-item"><i id="dog-icon" class="fa-solid fa-dog"></i>Pets allowed</li>
</ul>
</div>
I thank in advance anyone who will take the time to help me.

Change the static height: 10px to height: max-content; on .filter-item.
#filter-content{
display: flex;
flex-direction: row;
flex-flow: row wrap;
padding: 16px 0px 0px 16px;
}
#filter-nav{
display: flex;
flex-direction: row;
list-style: none;
}
.filter-item{
color: black;
font-family: Raleway;
font-size: 14px;
font-weight: bold;
height: max-content;
width: 100px;
line-height: 20px;
text-align: center;
margin-top: 5px;
margin-right: 30px;
border: 2px solid #F2F2F2;
border-radius: 10px;
cursor: pointer;
}
.filter-item:hover{
transform: scale(1.1);
background-color: #DEEBFF;
}
#money-icon{
position: relative;
right: 12px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#dog-icon{
position: relative;
right: 25px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#heart-icon{
position: relative;
right: 9px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
#person-icon{
position: relative;
right: 15px;
bottom: 2px;
color: #0065FC;
height: 24px;
width: 24px;
line-height: 22px;
border-radius: 10px;
background-color: #DEEBFF;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<script src="https://kit.fontawesome.com/1f544e41e8.js" crossorigin="anonymous"></script>
<div id="filter-content">
<h3>Filters</h3>
<ul id="filter-nav">
<li class="filter-item"><i id="money-icon" class="fa-solid fa-money-bill-wave"></i>Low cost</li>
<li class="filter-item"><i id="person-icon" class="fa-solid fa-child-reaching"></i>Family-friendly</li>
<li class="filter-item"><i id="heart-icon" class="fa-solid fa-heart"></i>Romantic</li>
<li class="filter-item"><i id="dog-icon" class="fa-solid fa-dog"></i>Pets allowed</li>
</ul>
</div>

Related

CSS li margin top not working can't put the li down

I was to put the red circle just right next to the line Sadon Huguet, but he is stuck just 10 pixel above and it's not perfectly aligned, I tried so much thing, but nothing seems to works. Thanks for your time
.vins_wino {
margin-top: 25px;
padding-right: 18px;
color: black;
}
.vin_wino {
font-size: 17px;
font-style: normal;
font-weight: normal;
border-bottom: dashed black;
border-bottom-width: 1px;
height: 30px;
position: absolute;
left: 8%;
}
.type_wino {
width: 30px;
height: 30px;
border-radius: 50%;
margin-top: 5.5px;
border: 2px solid black;
display: flex;
justify-content: space-between;
}
.price_wino {
font-weight: bold;
position: absolute;
right: 0;
margin-right: 20px;
<ol class="vins_wino" style="list-style-type: none;">
<li class="type_wino" style="background-color: #ac1e44;"></li>
<li class="vin_wino">Domaine Chapel - Fleurie Charbonnières 2018, 0,75L</li>
<li class="price_wino">29 €</li>
</ol>
You can also accomplish this using the pseudo-element ::before.
The ::before and ::after pseudo-elements in CSS allows you to insert content onto a page without it needing to be in the HTML.
Pseudo elements work great for ul's and ol's for custom bullet points.
Read more here
.vins_wino {
margin-top: 25px;
padding-right: 18px;
color: black;
}
.vin_wino {
font-size: 17px;
font-style: normal;
font-weight: normal;
border-bottom: dashed black;
border-bottom-width: 1px;
height: 30px;
position: absolute;
left: 8%;
}
li.vin_wino::before {
content: "";
background-color: #ac1e44;
position: absolute;
left: -2.5em;
bottom: 0;
width: 30px;
height: 30px;
border-radius: 50%;
border: 2px solid black;
}
.price_wino {
font-weight: bold;
position: absolute;
right: 0;
margin-right: 20px;
}
<ol class="vins_wino" style="list-style-type: none;">
<li class="type_wino"></li>
<li class="vin_wino">Domaine Chapel - Fleurie Charbonnières 2018, 0,75L</li>
<li class="price_wino">29 €</li>
</ol>
Use flex:
.vins_wino {
margin-top: 25px;
padding-right: 18px;
color: black;
display: flex;
}
.type_wino {
width: 30px;
height: 30px;
border-radius: 50%;
margin-top: 5.5px;
border: 2px solid black;
padding-right: 0;
}
.vin_wino {
font-size: 17px;
font-style: normal;
font-weight: normal;
border-bottom: dashed black;
border-bottom-width: 1px;
height: 30px;
margin-top: 9px;
margin-left: 5px;
}
.price_wino {
font-weight: bold;
flex: auto;
text-align: end;
margin-top: 5px;
}
<ol class="vins_wino" style="list-style-type: none;">
<li class="type_wino" style="background-color: #ac1e44;">
<li class="vin_wino">Domaine Chapel - Fleurie Charbonnières 2018, 0,75L</li>
<li class="price_wino">29 €</li>
</li>
</ol>

HTML/CSS Responsive design

I created a page with some buttons. All design is correct as is all positioning.
The problem of all is that it is not responsive.
I used some attributes like top, left and I think it hurt me in responsive design, but I may be wrong.
I wish that when reducing the window, the buttons would move (responsive design) automatically
Can anyone help me get everything responsive and in place?
CodePen
#inline-container img {
position: absolute;
display: block;
margin: 0px;
border: none;
padding: 0px;
}
#inline-container div {
position: absolute;
}
#inline-container {
display: block;
position: relative;
width: 1920px;
height: 1080px;
overflow: hidden; }
#_bg__home___quadrado___6_colunas {
top: 0px;
left: 0px;
width: 1920px;
height: 1080px;
background:rgba(255,255,255,255);
}
.search_box {
top:16px;
left: 1384px;
width: 216px;
height: 32px;
background-color: #edf3f9;
opacity: 0.8;
border: none;
border-radius: 16px;
line-height: 20px;
color: black;
text-indent: 40px;
position: relative;
}
.Upload {
top: 16px;
left: 76px;
width: 135px;
height: 32px;
}
.It {
top: 24px;
left: 728px;
width: 88px;
height: 24px;
}
.Ta {
top: 24px;
left: 944px;
width: 92px;
height: 24px;
}
.No {
top: 24px;
left: 1052px;
width: 141px;
height: 24px;
}
.Ca {
top: 24px;
left: 832px;
width: 96px;
height: 24px;
}
.btn-c{
opacity: 1;
top: 24px;
left: 832px;
width: 96px;
height: 24px;
text-align: center;
font: Bold 13px/20px Noto Sans;
letter-spacing: 0;
color: #4D4F5C;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgb(250, 250, 251);
outline:none;
cursor: pointer;
}
.btn-c:active{
width: 96px;
height: 24px;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgba(202,206,213,255);
opacity: 1;
}
.btn-n{
opacity: 1;
top: 24px;
left: 1052px;
width: 141px;
height: 24px;
text-align: center;
font: Bold 13px/20px Noto Sans;
letter-spacing: 0;
color: #4D4F5C;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgb(250, 250, 251);
outline:none;
cursor: pointer;
}
.btn-n:active{
width: 141px;
height: 24px;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgba(202,206,213,255);
opacity: 1;
}
.btn-i{
opacity: 1;
top: 24px;
left: 728px;
width: 88px;
height: 24px;
text-align: center;
font: Bold 13px/20px Noto Sans;
letter-spacing: 0;
color: #4D4F5C;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgb(250, 250, 251);
outline:none;
cursor: pointer;
}
.btn-i:active{
width: 88px;
height: 24px;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgba(202,206,213,255);
opacity: 1;
}
.btn-t{
opacity: 1;
top: 24px;
left: 944px;
width: 92px;
height: 24px;
text-align: center;
font: Bold 13px/20px Noto Sans;
letter-spacing: 0;
color: #4D4F5C;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgb(250, 250, 251);
outline:none;
cursor: pointer;
}
.btn-t:active{
width: 92px;
height: 24px;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background: rgba(202,206,213,255);
opacity: 1;
}
.btn-upload{
top: 16px;
left: 76px;
width: 135px;
height: 32px;
cursor: pointer;
-ms-border-radius: 16px;
-o-border-radius: 16px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
border-width: 0px;
background-color: rgb(232, 238, 245);
outline:none;
font-family: Noto Sans;
font-size: 13px;
text-align: center;
color:#4d4f5c;
}
<div style="width: 100%;height: 100%;">
<div style="width: 100%; height: calc(100% - 64px);">
<div id="inline-container" >
<div id="_bg__home___quadrado___6_colunas" ></div>
<div>
<input type="text" class="search_box" placeholder="Search..."/>
</div>
<div class="Upload" >
<button class="btn-upload"> Upload Files</button>
</div>
<div class="It">
<button class="btn-i">Settings</button>
</div>
<div class="Ta">
<button class="btn-t">Settings</button>
</div>
<div class="No">
<button class="btn-n">Settings</button>
</div>
<div class="Ca">
<button class="btn-c">Settings</button>
</div>
</div>
</div>
</div>
Here's how I would write the markup and styles for this. You can use flex-box.
https://jsfiddle.net/sheriffderek/yao1wdgp/ (live example)
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.page-section {
border: 1px solid orange;
}
.page-section .inner-column {
width: 98%;
max-width: 900px; /* arbitraty */
margin-right: auto;
margin-left: auto;
padding: 10px;
border: 1px solid blue;
}
.masthead {
border: 1px solid lime;
}
.masthead .settings-list {
margin: 0;
padding: 0;
list-style: none;
/* */
margin-top: 10px;
}
#media (min-width: 400px) {
.masthead {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.masthead .settings-list {
display: flex;
flex-direction: row;
margin-top: 0;
}
}
<header class="page-section site-header">
<div class="inner-column">
<nav class="masthead">
<button class="upload">upload</button>
<ul class="settings-list">
<li class="setting">
<button>Settings A</button>
</li>
<li class="setting">
<button>Settings B</button>
</li>
<li class="setting">
<button>Settings C</button>
</li>
<li class="setting">
<button>Settings D</button>
</li>
</ul>
</nav>
</div>
</header>
You'll have to change your positions from hardcoded pixels, ex 20px to a responsive measurement such as % or em. This is because pixels are fixed-size units while percent and ems are scalable units.
Try experimenting with different units and numbers until the page reacts in the manner you expect.
CSS Units explained
Just use #media only screen and (min-width: 600px) in your css. This helps you to allow different styling for different screen sizes. Use one for Pc, tablet and smartphone. You can change in it all other CSS Attributes.

Several images with title

I have a background with an image, in this bakground I have 3 images with 3 numbers. I would like for each number, center the number with the image.
I am stuck with the property margin-left
.background-picture-red{
height: 130px;
width: 100%;
position: absolute;
background-image: url(https://i.ibb.co/jVWdfG4/bg-2.jpg);
}
.picture01{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 50px;
z-index: 1;
position: relative;
}
.picture01-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: 50px;
margin-top: 100px;
position: absolute;
}
.picture02{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 60px;
z-index: 1;
position: relative;
}
.picture02-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: 50px;
margin-top: 100px;
position: absolute;
}
.picture03{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 70px;
z-index: 1;
position: relative;
}
.picture03-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: 10px;
margin-top: 100px;
position: absolute;
}
<div class="background-picture-red">
<img class="picture01" src="https://i.ibb.co/n3fv0YY/bitcoin34.png">
<span class="picture01-title">138</span>
<img class="picture02" src="https://i.ibb.co/qRSr1Wr/bitcoin46.png">
<span class="picture02-title">258</span>
<img class="picture03" src="https://i.ibb.co/BwT7gHz/bitcoin68.png">
<span class="picture03-title">303</span>
</div>
Here is a working example where I added to each title:
margin-left: -43px;
transform:translateX(-50%);
margin-left: -43px : because your image size is 86px so -43px will be placed in the middle of the image
translateX(-50%) : so the text will be centered depending of its own size
.background-picture-red{
height: 130px;
width: 100%;
position: absolute;
background-image: url(https://i.ibb.co/jVWdfG4/bg-2.jpg);
}
.picture01{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 50px;
z-index: 1;
position: relative;
}
.picture01-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: -43px;
transform:translateX(-50%);
margin-top: 100px;
position: absolute;
}
.picture02{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 60px;
z-index: 1;
position: relative;
}
.picture02-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: -43px;
transform:translateX(-50%);
margin-top: 100px;
position: absolute;
}
.picture03{
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
background-color: rgba(224,0,0,0.30);
float:left;
margin-top: 10px;
margin-left: 70px;
z-index: 1;
position: relative;
}
.picture03-title{
font-family: 'Questrial', sans-serif;
font-size: 16px;
color: white;
margin-left: -43px;
transform:translateX(-50%);
margin-top: 100px;
position: absolute;
}
<div class="background-picture-red">
<img class="picture01" src="https://i.ibb.co/n3fv0YY/bitcoin34.png">
<span class="picture01-title">138</span>
<img class="picture02" src="https://i.ibb.co/qRSr1Wr/bitcoin46.png">
<span class="picture02-title">258</span>
<img class="picture03" src="https://i.ibb.co/BwT7gHz/bitcoin68.png">
<span class="picture03-title">303</span>
</div>
But maybe you should use flexbox to do that kind of thing.

Stretch div's content evenly according to height

I've created This box, but i can't set it's content to stretch accordingly to it's height... once the view is stretched to height - the content is still fixed...and not spread evenly...I've tried to set padding with percentage to the LI - but it's not
working....is there a way to set it only with CSS?
.cont {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: space-between;
}
.box {
width: 40vw;
height: 50vh;
}
.row_wrapper {
display: flex;
flex-direction: column;
background-color: grey;
border-radius: 5px;
overflow: hidden;
width: 100%;
height: 100%;
}
.flex-row {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 0px 0px 0px 0px;
margin: 0px;
}
.flex-outer {
width: 100%;
padding: 0px 0px 0px 0px;
margin: 0px;
}
.flex-row li {
width: 50%;
/* padding-right: 10px; */
}
.flex-outer li {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding-bottom: 5px;
}
.select {
width: 100%;
border-radius: 5px;
border: 1px solid #dcdcdc;
padding: 5%;
font-size: 0.7vw;
}
.parameters_btn {
border: none;
background-color: #49c8c1;
border-radius: 0.5vw;
font-size: 0.9vw;
padding: 1% 5% 2% 5%;
color: #fff;
outline: none;
width: 50%;
height: 20%;
}
.parameters_btn:hover {
background-color: #40afa9;
outline: none;
}
.parameters_btn:active {
background-color: #2d7c78;
outline: none;
}
.user_box_header {
background-color: #fff;
min-height: 20%;
align-items: center;
justify-content: start;
display: flex;
padding-left: 15px;
border-bottom: 1px solid #e9e9e9;
}
.user_box_header span {
font-size: 0.8vw;
color: #3f4760;
font-family: 'Montserrat Bold', sans-serif;
font-weight: 600;
}
.user_box_header i:before {
padding-right: 0.5vw;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
font-size: 18px;
}
.user_notifications i:before {
content: "\f0a2";
}
.user_box_cont {
min-height: 80%;
padding: 5px 10px 5px 10px;
}
.material-switch {
width: 100%;
}
.material-switch>input[type="checkbox"] {
display: none;
}
.material-switch>label {
cursor: pointer;
height: 0px;
position: relative;
width: 40px;
}
.material-switch>input[type="checkbox"]+label::before {
content: "\f222";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #333333;
text-align: right;
border: 1px solid #dcdcdc;
padding-left: 10px;
padding-right: 10px;
font-size: 1vw;
}
.material-switch>label::before {
background-color: #f6f6f6;
border-radius: 50px;
height: 2.5vh;
margin-top: -12px;
position: absolute;
width: 8vw;
}
.material-switch>label::after {
/*--button---*/
content: "";
font-size: 1vw;
background-color: #fff;
border-radius: 50px;
height: 2.5vh;
left: -4px;
margin-top: -8px;
position: absolute;
top: -4px;
width: 6vw;
border: 1px solid #dcdcdc;
}
.material-switch>input[type="checkbox"]:checked+label::before {
background-color: #f6f6f6;
content: "\f221";
font-family: FontAwesome;
text-align: left;
font-size: 1vw;
}
.material-switch>input[type="checkbox"]:checked+label::after {
background-color: #fff;
left: 30px;
}
.femme {
display: none;
}
.material-switch>input[type="checkbox"]:checked+label>span.homme {
display: none;
}
.material-switch>input[type="checkbox"]:checked+label>span.femme {
display: block;
top: -8px;
}
.homme,
.femme {
font-family: 'Roboto Light', sans-serif;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #5d5d5d;
font-size: 0.7vw;
position: absolute;
top: -10px;
z-index: 999;
}
.material-switch>input[type="checkbox"]:checked+label .homme,
.material-switch>input[type="checkbox"]:checked+label .femme {
left: 43px;
}
.homme::before {
content: "\f222";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
margin-right: 5px;
}
.femme::before {
content: "\f221";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
margin-right: 5px;
}
<div class="cont">
<div class="box">
<div class="row_wrapper">
<div class="user_box_header user_notifications"><i></i>
<p>NOTIFICATIONS</p>
</div>
<div class="user_box_cont">
<ul class="flex-outer">
<li>
<ul class="flex-row">
<li>
<p>Select 3</p>
<select class="params_select">
<option>822-0123-56789</option>
<option>822-0123-56789</option>
<option>822-0123-56789</option>
</select>
</li>
<li>
<p>Select 4</p>
<select class="params_select">
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
</select>
</li>
</ul>
<li>
</li>
</ul>
<ul class="flex-outer">
<li>
<ul class="flex-row">
<li>
<p>Select 3</p>
<select class="params_select">
<option>822-0123-56789</option>
<option>822-0123-56789</option>
<option>822-0123-56789</option>
</select>
</li>
<li>
<p>Select 4</p>
<select class="params_select">
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
</select>
</li>
</ul>
<li>
<button class="parameters_btn">
Send
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
To fit the content in the div you must not set the height fixed, use height:auto; you can add max-height and max width, also min-width, min-height.
it's because of your row wrappers height is static ,change its style like code below
.row_wrapper {
display: flex;
flex-direction: column;
background-color: grey;
border-radius: 5px;
overflow: hidden;
width: 100%;
height: auto;
}
It might happen because of your .box height is statically 50vh. If you can change it to auto may give desired output.
Find updated fiddler here. Hope it helps.

Number section on button

I'm trying to create a button that looks like this:
The tricky part is getting the number to 'fit' inside of the button. This is how I have my button set up:
<button type="text" class="textclass"><span class="numberclass">33</span>Text</button>
This is my CSS:
.textclass {
width: 90px;
height: 30px;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 10px;
line-height: 12px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 20px;
}
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 0;
top: 0;
height:30px;
width: 30px;
border-radius: 2px 0 0 2px;
}
Setting the height and width of the number seems unnecessary, and I can't get the number to line up properly unless I get into extremely specific positioning which is not ideal. Where am I going wrong here?
Plunk:
http://plnkr.co/edit/0WUs3Y2axmOvfB7TswCb?p=preview
Try to this Define your .textclass position:relative;overflow:hidden; and .numberclass line-height:30px; as like this
/* Styles go here */
.textclass {
width: 90px;
position:relative;
overflow:hidden;
height: 30px;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 10px;
line-height: 12px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 20px;
}
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 0;
top: 0;
height:30px;
width: 30px;
line-height:30px;
border-radius: 2px 0 0 2px;
}
<div>
<button type="text" class="textclass"><span class="numberclass">33</span>Text</button>
</div>
or you just define button into span tag as like this
.textclass {
width: 90px;
position:relative;
overflow:hidden;
display:inline-block;vertical-align:top;text-align:center;
height: 30px;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 10px;
line-height: 30px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 20px;
}
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 0;
top: 0;
height:30px;
width: 30px;
line-height:30px;
border-radius: 2px 0 0 2px;
}
<div>
<span class="textclass"><span class="numberclass">33</span>Text</span></div>
Just give position: relative; to .textclass and line-height: 30px; to .numberclass
Updated Plunker
try this (replace it)
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 9px;
top: 8px;
height: 20px;
padding-top: 9px;
width: 30px;
border-radius: 2px 0 0 2px;
}
you can try this one:
.textclass {
width: 140px;
position:relative;
overflow:hidden;
height: 40px;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 15px;
line-height: 12px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 30px;
}
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 0;
top: 0;
height:40px;
width: 40px;
line-height:35px;
border-radius: 2px 0 0 2px;
}
DEMO HERE
Please, see the working plunker with completely auto adjusting height of the number part. You do not even need to apply the line-height.
HTML
<button type="text" class="textclass">
<span class="numberclass">
<span class="container"><span class="inner">33</span></span>
</span>
Text
</button>
CSS
.textclass {
width: 90px;
height: 30px;
position: relative;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 10px;
line-height: 12px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 20px;
}
.numberclass {
background-color: blue;
color: #FFF;
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 30px;
border-radius: 2px 0 0 2px;
display: block;
}
.container {
display: table;
height: 100%;
text-align: center;
width: 100%;
}
.inner {
display: table-cell;
height: 100%;
vertical-align: middle;
}
change in .numberclass class
/* Styles go here */
.textclass {
width: 90px;
height: 30px;
background-color: #FFF;
border: 1px solid blue;
color: blue;
font-size: 10px;
line-height: 12px;
font-weight: 600;
text-transform: uppercase;
border-radius: 2px;
padding-left: 20px;
}
.numberclass {
background-color: blue;
border-radius: 1px 0 0 1px;
color: #fff;
left: 8px;
padding: 8px;
position: absolute;
top: 9px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div>
<button type="text" class="textclass"><span class="numberclass">33</span>Text</button>
</div>
</body>
</html>