我的CSS出现问题。
我已附上2张图片。第一个显示div的高度设置为110px,与旁边的图像相比,可以看到该高度已正确设置,并且显示了滚动条。
现在,我想更改div的高度,以使其高度为100%(与图片水平),并且由于文本不合适,它将显示滚动条。相反,如您在第二个屏幕截图中所看到的,文本超出了图片的高度。
如何使div与图像高度相同,以便滚动条出现?
<section class="slideInRight">
<div class="wrap">
<img src="img/slide1.png" class="alignright size-75">
<div class="alignleft size-20 scrollText">
<p>In this course, we’re focussing on three main areas.</p>
<p><strong>The Software Development Lifecycle</strong><br />
This is essential in understanding how development teams work within IT. Questions around the software
development life cycle will pop up in interviews so it’s essential to grasp the knowledge around this
area.</p>
<p><strong>IT Support and Testing</strong><br />
These two areas are perfect to step into an IT career and progress further. They start off non-technical
so anyone can make a start in it and then you can decide if you want to progress to a more technical
role or branch out to different areas in IT.</p>
</div>
</div>
</section>
这是我的CSS:
.scrollText{
font-size:medium;
overflow: auto;
height: 80%;
}
我认为您应该看看其中一些解决方案,看看其中是否适合您的情况。
您应该尝试将height
样式中的值更改为实际数字而不是百分比,然后查看这是否对展示效果有所影响。上面的解决方案具有确切的价值,height
并且似乎可以这样工作。
这是专门处理div中图像的解决方案:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句