Этот код отлично работает на Firefox и Chrome, но не на IE 10. Синяя часть не соответствует правильному размеру в IE 10
Я думаю, проблема связана с:
.main-scroll {
position: relative;
height:100%;
width: 100%;
border-color: blue;
border-style:solid;
overflow-y: scroll;
}
который его height: 100%
кажется, не работает должным образом. Как я знаю, все используемые стили действительны в HTML 5.0 и CSS 3.0.
Вопрос: Итак, почему этот код не работает должным образом в IE 10 и какой обходной путь?
установить #body в относительное положение
#body {
height: 100px;
width: 200px;
position:relative;/*so that the children can habe an absolute position*/
}
а потом
.main-scroll {
position: absolute;
height:100%;
width: 100%;
border-color: blue;
border-style:solid;
overflow-y: scroll;
}
Демо: http://jsfiddle.net/8Vu92/3/
я не знаю, что вы пытаетесь сделать, но если вы просто хотите, чтобы синий и красный цвета можно использовать box-shadow
Демо: http://jsfiddle.net/8Vu92/4/
<section class="main">
This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content.
</section>
css
.main {
height: 100px;
width: 200px;
position:relative;
overflow:auto;
border:4px solid blue;
box-shadow:0 0 0 4px red;
padding: 10px;
box-sizing:border-box;
}
ОБНОВЛЕНИЕ: использование преобразования
#body {
height: 100px;
width: 200px;
}
.shell {
height: 100%;
width: 100%;
display: table;
border-color: red;
border-style:solid;
}
.header-row {
display: table-row;
height: 40px
}
.main-row {
height:100%;
width: 100%;
display: table-row;
border-style:solid;
}
.main-scroll {
height:120px;
width: 100%;
border-color: blue;
border-style:solid;
overflow-y: scroll;
transform:translate3d(0,30px,0);
}
.main {
display:block;
height: 100%;
width: 100%;
}
разметка:
<div id="body">
<div class="shell">
<div class="header-row">
This is the fixed height header
</div>
<div class="main-row">
<div class="main-scroll">
<section class="main">This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content. This is the content.</section>
</div>
</div>
</div>
</div>
.main-scroll {
position: relative;
border-color: blue;
border-style:solid;
width:150px;
height:150px;
overflow:scroll;
}
попробуйте это в IE