おせわになっております。
助けてください。。
HTML5で現在、レスポンシブ対応のサイトを作っています。
ウインドウを縦、横に動かしてもサイトがその幅に合わせて伸縮するといいますか、
あんまり文章が思いつかず申し訳ないですが、
そのようなことをしたいのです。
その際、CSSで幅と高さを%表示にて
レスポンシブさせようとしているのですが、
どうしても「高さ」がレスポンシブ対応になりません。。
どうかご教示いただけましたら幸いです。
宜しくお願いいたします。。
HTMLを載せます。
HTML5
1<!DOCTYPE html> 2<html lang="ja"> 3 <head> 4 <meta charset="utf-8"> 5 <link rel="stylesheet" href="css/style.css"> 6 </head> 7 <body> 8 <div id="wrapper"> 9 <section> 10 <form action="#" method="post"> 11 <button type="submit" id="section_submit">ログアウト</button> 12 </form> 13 <h2 id="h2_section">eee</h2> 14 <div class="chatroom_section"> 15 <div class="chatroom_say_left"> 16 <p> 17 TO<br> 18 <img src="images/flower2.jpeg" alt="花" id="chatroom_left_img"><br> 19 </p> 20 </div> 21 <div class="chatroom_say_front"> 22 <p class="balloon-1-left"> 23 行間は「1.5em(20pxくらい)」<br> 24 </p> 25 </div> 26 <div class="chatroom_say_front_right"> 27 <p class="balloon-2-right"> 28 左と同じ 29 </p> 30 </div> 31 <div class="chatroom_say_right"> 32 <p> 33 TO:<br> 34 <img src="images/flower.png" alt="花" class="chatroom_right_img"><br> 35 </p> 36 </div> 37 <div class="day"> 38 <p>2016/11/21(月)<br><hr></p> 39 </div> 40 </div> 41 <div id="chatroom_config"> 42 <div id="chatroom_top"> 43 仮ボックス 44 </div> 45 <div id="chatroom_bottom"> 46 <div id="chatroom_bottom_left"> 47 <p><img src="images/flower4.png" alt="花" id="chatroom_img"></p> 48 <p> 49 佐藤、鈴木<br> 50 <span id="square_color">■</span> なんか入れる 51 </p> 52 </div> 53 <div id="chatroom_bottom_right"> 54 <form action="#" method="post" id="chatroom_sendform"> 55 <label> 56 <textarea name="chatroom_send_info" placeholder="" 57 id="chatroom_info" form="chatroom_sendform" maxlength="1001" required></textarea> 58 </label> 59 <button type="submit" id="sendsubmit">example</button> 60 </form> 61 </div> 62 </div> 63 </div> 64 </section> 65 <aside> 66 <h2 id="aside_h2">イメージ一覧</h2> 67 <div id="over"> 68 <div class="front_aside"> 69 <div class="left_aside"> 70 <p><img src="images/flower.png" alt="花" class="img_aside"></p> 71 </div> 72 <div class="right_aside"> 73 <p> 74 花子 75 </p> 76 </div> 77 </div> 78 </div> 79 </aside> 80 </div> 81 <footer> 82 <hr> 83 Copyright © 84 </footer> 85 </body> 86</html>
CSSを載せます。
CSS
1@charset "utf-8"; 2 3/* all reset */ 4html { 5 height: 100%; 6} 7 8body { 9 width: 100%; 10 height: 100%; 11 margin: 0; 12 padding: 0; 13 font-family: "MS ゴシック",sans-serif,"Hiragino Kaku Gothic Pro",Meiryo, Osaka,"MS PGothic", sans-serif; 14 clear: both; 15} 16 17img { 18 margin: 0; 19 padding: 0; 20} 21 22/* wrapper */ 23/* 1366(横) * 768(縦) */ 24#wrapper { 25 background-color: skyblue; 26 width: 100%; 27 margin: auto; 28 margin-top: 30px; 29 padding: auto; 30 border-top: solid 1px black; 31 border-left: solid 1px black; 32 border-bottom: solid 1px black; 33} 34 35/* section */ 36section { 37 float: right; 38 clear: both; 39 width: 75%; 40 height: 100%; 41 margin-bottom: 20px; 42 line-height: 2em; 43 border-right: solid 1px black; 44} 45 46section .chatroom_section { 47 margin: auto; 48 padding: auto; 49 text-align: center; 50 line-height: 1.5em; 51 width: 95%; 52 height: 515px; 53 overflow-y: scroll; 54 border: solid 1px black; 55 background-color: #fafafa; 56 clear: both; 57} 58 59 60section .chatroom_section .chatroom_say_left { 61 float: left; 62 margin: 0; 63 padding: 0; 64 width: 20%; 65 height: 15%; 66 clear: both; 67} 68 69section .chatroom_section .chatroom_say_left p { 70 color: #5a5a5a; 71 margin: 0; 72 padding: 0; 73 padding-top: 40px; 74 font-size: 10px; 75 clear: both; 76} 77 78section .chatroom_section .chatroom_say_left #chatroom_left_img { 79 margin: 0; 80 padding: 0; 81 padding-top: 5px; 82 width: 35%; 83 height: 50%; 84 clear: both; 85} 86 87section .chatroom_section .chatroom_say_front { 88 float: left; 89 width: 80%; 90 padding-top: 40px; 91} 92 93section .chatroom_section .chatroom_say_front_right { 94 float: left; 95 width: 80%; 96} 97 98.chatroom_say_right { 99 float: right; 100 margin: 0; 101 width: 20%; 102 height: 15%; 103} 104 105.chatroom_say_right p { 106 color: #5a5a5a; 107 margin: 0; 108 padding: 0; 109 padding-top: 10px; 110 font-size: 10px; 111} 112 113.chatroom_right_img { 114 margin: 0; 115 padding: 0; 116 padding-top: 5px; 117 width: 35%; 118 clear: both; 119} 120 121.day { 122 clear: both; 123} 124 125.day p { 126 color: #808080; 127 font-size: 12px; 128} 129 130.day hr { 131 width: 95%; 132} 133 134section h2#h2_section { 135 margin-top: 40px; 136 margin-left: 25px; 137} 138 139section #chatroom_config { 140 margin: auto; 141 margin-top: 10px; 142 padding: auto; 143 width: 95%; 144 clear: both; 145} 146 147section #chatroom_config #chatroom_top { 148 margin: auto; 149 padding: auto; 150 width: 100%; 151 height: 45%; 152 border: solid 1px black; 153 text-align: center; 154} 155 156/* section chatroom_bottom */ 157section #chatroom_config #chatroom_bottom { 158 margin: auto; 159 margin-top: 10px; 160 padding: auto; 161 width: 100%; 162 height: 85px; 163 text-align: center; 164 border: solid 1px black; 165 clear: both; 166} 167 168section #chatroom_config #chatroom_bottom #chatroom_bottom_left { 169 float: left; 170 width: 30%; 171 height: 100%; 172 margin: auto; 173 padding: auto; 174 clear: both; 175} 176 177section #chatroom_config #chatroom_bottom #chatroom_bottom_left #chatroom_img { 178 margin-left: 20px; 179 width: 22%; 180 float: left; 181} 182 183#square_color { 184 color: cyan; 185} 186 187section #chatroom_config #chatroom_bottom #chatroom_bottom_right { 188 float: right; 189 width: 70%; 190 height: 76px; 191 margin: auto; 192 margin-top: 5px; 193 padding: auto; 194} 195 196section #chatroom_config #chatroom_bottom #chatroom_bottom_right textarea { 197 width: 80%; 198 height: 70px; 199 margin: auto; 200 padding: auto; 201} 202 203/* section submit */ 204section button#section_submit { 205 float: right; 206 margin-top: 20px; 207 margin-right: 20px; 208 padding: 5px; 209 background-color: #ffff7f; 210 clear: both; 211} 212 213/* form */ 214 215textarea#chatroom_info { 216 float: left; 217 font-size: 15px; 218} 219 220textarea#chatroom_info:focus { 221 background-color: pink; 222} 223 224button#sendsubmit { 225 width: 15%; 226 height: 70px; 227 margin-top: 3px; 228 background-color: #84c1ff ; 229 font-size: 20px; 230} 231 232button#sendsubmit:hover { 233 color: white; 234 font-size: 25px; 235 font-style: italic; 236 text-shadow: 3px 3px 5px deeppink; 237 background-color: firebrick; 238} 239 240/* aside */ 241aside { 242 float: left; 243 width: 23%; 244 height: 758px; 245 padding-top: 1px; 246 line-height: 1.5em; 247 text-align: center; 248 border-right: solid 1px black; 249 border-bottom: solid 1px black; 250} 251 252aside #over { 253 background-color: green; 254 height: 700px; 255 overflow-y: scroll; 256 width: 98%; 257 margin-left: 1%; 258} 259 260aside .front_aside { 261 width: 90%; 262 margin: auto; 263 padding: auto; 264 padding-top: 1px; 265 clear: both; 266 border-bottom: solid 1px black; 267 background-color: yellow; 268} 269 270aside .front_aside .left_aside { 271 float: left; 272 margin: auto; 273 margin-top: 4px; 274 padding: auto; 275 width: 40%; 276 clear: both; 277} 278 279aside .front_aside .left_aside .img_aside { 280 margin: 0; 281 padding: 0; 282 width: 60%; 283 height: 100%; 284} 285 286aside .front_aside .right_aside { 287 float: right; 288 margin: auto; 289 margin-top: 20px; 290 padding: auto; 291 width: 60%; 292} 293 294aside .front_aside .right_aside .rightaside_states { 295 color: cyan; 296} 297 298/* footer */ 299footer { 300 width: 90%; 301 height: 90%; 302 margin: auto; 303 margin-bottom: 35px; 304 padding: auto; 305 padding-top: 20px; 306 clear: both; 307} 308 309footer hr { 310 margin-top: 20px; 311 margin-bottom: 35px; 312 clear: both; 313} 314 315/* link */ 316a:link { 317 318} 319 320a:visited { 321 322} 323 324a:focus { 325 326} 327 328a:hover { 329 330} 331 332a:active { 333 334} 335 336/* 吹き出し 左 */ 337section .chatroom_section .chatroom_say_front .balloon-1-left { 338 display: inline-block; /* コメントの文字数に合わせて可変 */ 339 padding: 15px 20px; 340 margin-top: 8px; 341 margin-right: 80px; 342 border-radius: 30px; 343 position: relative; 344 background-color: #D9F0FF; 345 text-align: left; 346 width: 80%; 347} 348 349section .chatroom_section .chatroom_say_front .balloon-1-left:after { 350 content: ""; 351 position: absolute; 352 top: 20px; left: -30px; 353 margin-top: -10px; 354 display: block; 355 width: 0px; 356 height: 0px; 357 border-style: solid; 358 border-width: 40px 40px 40px 0px; 359 border-color: transparent #D9F0FF transparent transparent; 360} 361 362/* 吹き出し 右 */ 363section .chatroom_section .chatroom_say_front_right .balloon-2-right { 364 display: inline-block; /* コメントの文字数に合わせて可変する処理 */ 365 padding: 15px 0px 15px 15px ; 366 margin-left: 50px; 367 border-radius: 30px; 368 position: relative; 369 text-align: left; 370 background: #ffa3d1; 371 width: 80%; 372} 373 374.balloon-2-right:before { 375 content: ""; 376 position: absolute; 377 top: 10%; right: -70px; /* 三角の吹き出し部分の位置を決める */ 378 display: block; 379 border-style: solid; 380 border-width: 40px 40px 40px 40px; 381 border-color: transparent transparent transparent #ffa3d1; 382}
回答3件
あなたの回答
tips
プレビュー