我是新來的,目前我正在做一個項目,我堅持這一點。主div內有3個div。而且我必須根據內容自動調整div的高度。任何人都可以爲此提出解決方案。該代碼是如何根據內容調整div的高度?
<!DOCTYPE html>
<html>
<head>
<style>
#rcorners2 {
position: absolute;
border-radius: 25px;
border: 2px solid #d3dce2;
padding: 20px;
width: 722px;
height:450px;
left: 151px;
top: 64px;
}
#img {
position: absolute;
width: 266px;
height: 260px;
left: 32px;
top: 42px;
}
#desc {
position: absolute;
font-size: 16px;
padding: 5px 15px 5px 5px;
width: 373px;
left: 321px;
top: 42px;
height: 100%;
line-height:1.6;
}
.vr {
width: 2px;
background-color: #d3dce2;
position: absolute;
top: 5px;
bottom: 50px;
left: 310px;
height: 317px;
}
</style>
</head>
<body>
<p>Rounded corners for an element with a border:</p>
<div id="rcorners2">
<div id="img">
<img src="SLT-A99V_wSAL2470Z_lg.jpg" height="260px" width="265">
</div>
<div class="vr"> </div>
<div id="desc">
Photography studio management software that helps grow your business, frees up your time, automatically keeps in touch with your clients and makes sure all your jobs stay on track! Studio Ninja reminds you when tasks are due and keeps all your jobs on track and consistent. Just set it up once and never forget a thing again. Check out which jobs are coming up from one convenient location or easily integrate it with Google Calendar or iCalendar. Photography studio management software that helps grow your business, frees up your time, automatically keeps in touch with your clients and makes sure all your jobs stay on track! Studio Ninja reminds you when tasks are due and keeps all your jobs on track and consistent. Just set it up once and never forget a thing again. Check out which jobs are coming up from one convenient location or easily integrate it with Google Calendar or iCalendar.
</div>
</div>
</body>
</html>
autoadjust'height'其中'div'? –
我想調整主divcorcorners2的高度。 –
調整到哪個「高度」?看到這裏是** [DEMO](https://jsfiddle.net/Guruprasad_Rao/6s2g0h2m/)**我已經使用你的代碼創建了..你能告訴我什麼應該是'div'的高度' ? –