Reputation: 1545
I have a div position:absolute
inside a relative
container div. The absolute
positioned div
has a percentage width, and when I reduce the browser size, thus shrinking the div
's size the li
text get's cut off, I will include a screenshot. I want the text in the li
to break to a new line without writing a <br>
because these will be generated dynamically. Ok here is my code
//HTML
<div class="information-toggle">
<aside class="information-toggle__list">
<ul>
<li>Meaningless Existence</li>
<li>Meaningless Existence</li>
<li>Meaningless Existence</li>
<li>Meaningless Existence</li>
</ul>
</aside>
<div class="information-toggle__content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</div>
</div>
//SASS
.information-toggle{
// border:1px solid red;
position:relative;
margin:0 auto;
font-family: 'Avenir',sans-serif;
}
.information-toggle__list{
width:100%;
// border:1px dashed green;
z-index: 100;
position:relative;
@media only screen and (min-width: 768px) {
position:absolute;
width:25%;
}
ul{
list-style-type: none;
padding: 0;
text-align: center;
overflow-x:scroll;
white-space: nowrap;
@media only screen and (min-width: 768px) {
display:list-item;
overflow-x:initial;
}
li{
background: $button-red;
border-bottom: 2px solid #ffffff;
font-weight: 500;
@include font-size(2.0);
letter-spacing: 0.08px;
position: relative;
height: 46px;
line-height: 46px;
display: inline-block;
color: $white;
margin: 5px;
border-radius:5px;
@media only screen and (min-width: 768px) {
display:list-item;
border-radius:initial;
border-top-left-radius:5px;
border-bottom-left-radius:5px;
margin:initial;
height: 67px;
line-height: 67px;
}
&:hover {
background:$button-red-hover;
@media only screen and (min-width: 768px) {
@include rightArrow();
font-weight:900;
}
}
}
}
}
.information-toggle__content{
width: 100%;
// border: 1px dashed orange;
margin-left: auto;
padding: 25px;
background: $white;
//transform: translateY(33px);
@media only screen and (min-width: 768px) {
padding: 50px;
width: 75%;
transform: translateY(33px);
}
}
and here is what it looks like to me
Upvotes: 0
Views: 4250
Reputation: 1
On li
item put whitespace: normal
, height: auto
and min-height: 67px
Upvotes: 0