i want a css code that div class overflow-y scroll if height if more than 500px
You can use the following CSS code to make a div scrollable vertically (overflow-y: scroll) if its height exceeds 500px:
div.scrollable {
max-height: 500px;
overflow-y: auto;
}
In this code, the div element should have a class of "scrollable". The max-height property restricts the height of the div to a maximum of 500px. If the content inside the div exceeds this height, a vertical scrollbar will appear due to the overflow-y: auto property.
You can adjust the class name and the maximum height value as per your requirement
原文地址: http://www.cveoy.top/t/topic/ioxH 著作权归作者所有。请勿转载和采集!