Как растянуть DIV на основе содержимого

0

У меня есть div, который содержит некоторое содержимое, а HTML:

<div id="subpageFooter">
    <div id="subpageFooterLeft">
        <div style="z-index: 15; position: relative; left: 0; padding-left: 20px; padding-top: 30px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            State-Of-The-Art-Technology
        </div>
        <div style="z-index: 14; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
            Our state-of-the-art technology ensures that we provide the finest healthcare. Our practice continuously invests in systems and equipment so that physicians can diagnose problems in the most accurate and efficient manner possible.
        </div>
        <div style="position: relative; width: 90%; padding-left: 5%; padding-top: 10px; padding-right: 5%;"><hr /></div>
        <div style="z-index: 13; position: relative; left: 0; padding-left: 20px; padding-top: 10px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            Advanced Electronic Medical Records
        </div>
        <div style="z-index: 12; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
            Our advanced electronic medical record improves patient care and gives physicians all of the important patient information they need in one place.
        </div>
        <div style="position: relative; width: 90%; padding-left: 5%; padding-top: 10px; padding-right: 5%;"><hr /></div>
        <div style="z-index: 11; position: relative; left: 0; padding-left: 20px; padding-top: 10px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            Premier Radiology Services
        </div>
        <div style="z-index: 10; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000;font-size: 12px;">
            Filmless radiology capabilities provide rapid results and allow physicians to view images on an office computer screen within minutes. Our premier radiology services include MRI, CT scan, ultrasonography, nuclear medicine, bone densitometry and mammography. We offer computer-aided diagnosis (CAD), which is a tool to assist the radiologist in more accurately diagnosing breast disease.
        </div>
        <div style="position: relative; width: 90%; padding-left: 5%; padding-top: 10px; padding-right: 5%;"><hr /></div>
        <div style="z-index: 9; position: relative; left: 0; padding-left: 20px; padding-top: 10px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            Our Employees Make MED a Special Place
        </div>
        <div style="z-index: 8; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
            MED values each of our employees experience, diversity and dedication. Ideas and backgrounds that our employees bring to our company enable us to be more effective in anticipating and exceeding our patients needs and expectations. <a class="blueLinks" href="http://www.MEDgroup.com/talented_people.aspx">Click here</a> for the opportunity to meet some of the employees who greatly contribute to our success.
        </div>
        <div style="position: relative; width: 90%; padding-left: 5%; padding-top: 10px; padding-right: 5%;"><hr /></div>
        <div style="z-index: 7; position: relative; left: 0; padding-left: 20px; padding-top: 10px; font-weight: bold; color: #00A0BE; font-size: 13px;">
            Wide Range Of Insurances
        </div>
        <div style="z-index: 6; position: relative; left: 0; padding-left: 40px; padding-top: 10px; padding-right: 8px; font-weight: normal; color: #000000; font-size: 12px;">
            A big advantage to using MED Medical Group is the <a class="blueLinks" href="http://www.MEDgroup.com/participating_insurance.aspx?id=473">wide range of insurance coverage</a> accepted. This means you should be able to keep your doctors even if you find you have to change insurance plans. We care equally about every patient regardless of the insurance provider.
        </div>
    </div>
    <div id="subpageFooterRight">
        <!-- #include virtual ="includeNav/hospAff.inc" -->
    </div>
</div>

CSS:

#subpageFooter {
    position: relative;
    width: 100%;
    height: 715px;
    background: url('../theImages/bg_90_w.png');
    /*box-shadow: 0 0 10px #FFFFFF;*/
}
#subpageFooterRight {
    position: absolute;
    right: 0;
    width: 40%;
    height: 100%;
    float: right;
    background-color: #CCCCCC;
    background: url('../theImages/vshadow.png') 0 0 repeat-y;
    text-align: center;
}
#subpageFooterLeft {
    position: absolute;
    left: 0;
    float: left;
    width: 60%;
    height: 100%;
}

Когда я увеличиваю масштаб, содержимое выходит за пределы subpageFooterLeft div

Изображение 174551

Как я могу изменить его, чтобы div растягивался в соответствии с содержимым?

Теги:
css-position

4 ответа

0

Попробуйте это в css:

height: auto;
0

Попробуй это:

overflow:hidden;
height:1%;
  • 1
    где я должен добавить это?
0

Проблема в том, что вы устанавливаете height: 100% на #subpageFooterLeft. Удаление этого правила устраняет проблему масштабирования:

http://jsfiddle.net/qtDm3/

#subpageFooterLeft {
    position: absolute;
    left: 0;
    float: left;
    width: 60%;
    /* height: 100%; */
}
  • 0
    Я думаю, что причиной проблемы является то, что я использую Media Queries и в зависимости от размера экрана меняю таблицу стилей. Как я могу убедиться, что на рабочем столе не работает ни один из стилей, не относящихся к рабочему столу?
  • 0
    Не уверен, что вы подразумеваете под "настольным ни один". Возможно ли, что у вас все еще есть height: 100% или другое значение высоты, назначенное в одном из ваших медиа-запросов?
0

Вы можете попробовать поставить это в css также:

overflow:auto;

Ещё вопросы

Сообщество Overcoder
Наверх
Меню