0

すべての div を中央に配置したいので、画面が小さくなると中央に配置されたまま小さくなります

ここにフィドルリンクがあります: http://jsfiddle.net/h6253/1/

コード例:

#first_section {
   width: 0 auto;
   height: 776px;
   font-family: 'Raleway', sans-serif;



}

#square {
   width: 857px;
   height: 4px;
   background-color: #2a2d2f;
   margin-bottom: 10px;
}

#first_section_txt {
   position: relative;
   width: 997px;
   height: 164px;
   margin-left: 500px;
   margin-top: 251px;
}

.clear_both {
   clear: both;
}

h1 { font-family: 'Source Code Pro', sans-serif;
    font-weight: 500;
    font-size: 111px;
    display: inline;
    color: #4a4949;
     }
h2 { font-family: 'Source Code Pro', sans-serif;
    font-weight: 400;
    font-size: 111px;
    display: inline;
    color: #c0c0c0;
     }
h3 { font-family: 'Source Code Pro', sans-serif;
    font-weight: 200;
    font-size: 25px;
    display: inline;
    color: #a7a7a7;
    padding-left: 350px;
    top: 15px;
     }

     h3{
      text-shadow: 2px 2px 2px rgba(150, 150, 150, 0.37);
     }
#first_section img {
   position: relative;
   margin-left: 525px;
   width: 466px;
   height: 540px;
   margin-top: -150px;

}
4

4 に答える 4

0

あなたの問題を理解しているかどうかわかりません。jsFiddle で問題をさらに切り分けてください。たぶん絶対配置を試してください:

HTML:

<div class="centered">
    <h1>Title 1</h1>
    <h2>Title 2</h2>
    <img src="http://placehold.it/250x100" />
</div>

CSS:

.centered {
    position: absolute;
    top: 20%; left: 20%; right: 20%; bottom: 20%;
}

ここで確認してください:http://jsfiddle.net/h6253/6/

于 2013-11-10T23:55:47.273 に答える