I have a List, and I want to set a static maximum height on each item of the list and show a scrollbar when the text overflows it: I have the following code:
HTML
<ul>
@foreach(var item in List)
{
<li>
<a />
</li>
}
</ul>
CSS (I have more styles, but for the sake of exemplifying, I posted only the relevant ones)
ul, li
{
overflow-y:auto;
}
ul li a
{
background: #ffc;
display: block;
height: 08em;
}
PROBLEM
The background color will only apply for the defined height. So how can I resolve it? I assume by envolving <li>
on another tag and applying the styles to that tag instead, but I'm not sure how to apply that
Edit I would like to point to the answer of Michael Benjamin on Make background color extend into overflow area