3

ここの初心者。

私はレスポンシブ デザインを学ぼうとしていますが、Chrome で期待どおりに動作しているときに、ie9 で最大幅の問題に遭遇しました。ブラウザウィンドウを調整するときに、スケーリングしようとしている画像の最大幅を調整するだけではありません。html コードと css を表示させてください。

HTML コード:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is a test</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/resetmin.css" />
<link rel="stylesheet" type="text/css" href="css/test3.css" />  
</head>
<body>
<div style="background-color:black; height:35px;"></div>
<div id="container">
    <div class="content">
        <div class="header">
        <h1>This is my header</h1>
        </div>
        <div class="pic">
            <img src="image001.jpg" alt="Just a picture 815px width and 500px height"></img> 
        </div>
        <div class="imageControl">
        </div>
        <div class="clear"></div>
    </div>
<div class="content">
        <div class="header">
        <h1>This is my header</h1>
        </div>
        <div class="pic">
            <img src="image002.jpg" alt="Just a picture 500px width and 815px height"></img> 
        </div>
        <div class="imageControl">
        </div>
        <div class="clear"></div>
    </div>
    <div class="sideBar"></div>
    <div class="padding"></div>
</div>

<div style="background-color: #555; width: 960px; height: 485px; margin: 0 auto; clear: both;"></div>
</body>
</html>

CSS コード: test3.css

body {
color: #333;
font: 100%/1.5 Cambria, Georgia, serif;
background: #ece6d6 url(_assets/bg-light.png) repeat;
/* margin: 0 auto; */
}

img {
display: block;
max-width: 100%;
}

#container {
width: 960px;
margin: 0 auto;
background-color: #aaa;
}

.header {
height: 40px;
border-top: 1px solid #000;
}

.content {
background-color: grey;
float: left;
margin: 15px 15px 0px 15px;
}

.pic {
width: auto;
padding: 15px;
background-color: #777;
float: left;
/* position: relative;
top: 15px;
left: 15px; */
}   

.imageControl {
width: 85px;
height: 350px;
background-color: #ccc;
float: right;
/* position: relative;
top: 15px;
left: 15px; */
}

.clear {
clear: both;
}

.padding {
padding-bottom: 15px;
clear: both;
}

.sideBar {
width: 300px;
height: 250px;
margin: 15px 15px 0px 0px;
float: right;
background-color: #333;
}

h1 {
font: bold 1.6em Cambria, Georgia, serif;
}

@media screen and (max-width: 980px) {

#container {
    width: 95%;
}

.sidebar {
    width: 30%;
}
.sidebar .widget {
    padding: 8% 7%;
    margin-bottom: 10px;
}

}

ぜひご覧いただき、ご検討ください。それはまだ進行中の作業なので、ブラウザーを調整するときに乱雑なレスポンシブ デザインを気にしないでください (IE9 では縮小されないため、今の私の問題は画像です)。

ありがとう。それでも不明な点がある場合は、お問い合わせください。回答を試みます。

4

2 に答える 2

3

それを見つけた。多くのいじくり回した後、これが今のところ私の解決策です。これは、html および css コードで追加/編集するものです。

編集された HTML コード:

<div class="pic">
   <img class="imageObject" src="image001.jpg" alt="Just a picture 815px width and 500px height"></img> 
</div>

追加された CSS コード:

img.imageObject {
margin:0 auto;
width:100%;
max-width:50.3975em;
}

理由については、まだ理由の説明を探しています。しかし、これでうまくいくでしょう。

于 2012-07-15T08:39:35.407 に答える
0

可能な修正は次のとおりです。

CSS:

.scale
{
    max-width:980px;
}
.scale img
{
    display:block;
    max-width:80% //your value
}

HTML:

<div class="scale">
    <img src="...."/>
</div>
于 2014-09-04T17:58:30.790 に答える