I want to set child item height in various screen size as dynamically using sass function instead of writing manually. I know we can use css position: absolute;
property or simply use jQuery code to get the result, but I want to achieve child item value using with sass function.
**We can give width as percentage value, but height can't result without giving position: absolute;
when giving percentage value.
Check my pen : http://codepen.io/nikhil8krishnan/pen/adqbeR?editors=1000
Check below codes , Here I'm writing item value manually on each screen size.
Outputs
.container {
background-color: red;
margin: auto;
text-align: center;
color: #fff;
font-size: 0;
}
.child {
display: inline-block;
border-right: solid 1px #fff;
background-color: green;
}
/* container width and child width & height is set by manually on each screen size*/
/*max to 767px*/
.container {
width: 100%;
}
.child {
width: 25%;
height: 25%;
}
@media (min-width: 768px) {
.container {
width: 600px;
}
.child {
height: 150px;
width: 150px;
}
}
@media (min-width: 980px) {
.container {
width: 800px;
}
.child {
height: 200px;
width: 200px;
}
}
@media (min-width: 1200px) {
.container {
width: 1000px;
}
.child {
height: 250px;
width: 250px;
}
}
How can I write those codes with sass functions? Is it possible please share thoughts.