###希望のデザインと問題点
HTML5のいろんなデザインをサイトから引っ張って試していて、そのボックス(プログラムは後述)をまず上から数ピクセル固定、左右からは真ん中のところに固定し、そのボックスからまた一定の間を置いて下に内容を、左右から真ん中のところからはじめたいのですが、そのボックスの後に内容を<p>で始めたら、サイドバーのように、そのボックスの右に来て、そのボックスと内容二つをセットとして考えたときの真ん中に来るようになりました。(つまりボックスがメインバー、内容がサイドバーのように位置している)。
こちらがそのプログラムです。
html
1<!DOCTYPE html> 2<html lang="ja"> 3 <head> 4 <meta charset="utf-8"> 5 <title>title</title> 6 </head> 7 <style media="screen"> 8html, body { 9 height: 100%; 10} 11 12html { 13 background:#1c1c1c; 14} 15 16body { 17 display: flex; 18 justify-content: center; 19 20} 21 22.box { 23 width: 300px; 24 height: 300px; 25 border-radius: 150px; 26 box-shadow: 0 2px 30px rgba(black, .2); 27 background: lighten(#f0f4c3, 10%); 28 position: relative; 29 overflow: hidden; 30 transform: translate3d(0, 0, 0); 31} 32 33.wave { 34 opacity: .4; 35 position: absolute; 36 top: 5px; 37 left: 50%; 38 background: #0af; 39 width: 500px; 40 height: 500px; 41 margin-left: -250px; 42 margin-top: -250px; 43 transform-origin: 50% 48%; 44 border-radius: 43%; 45 animation: drift 3000ms infinite linear; 46} 47 48.wave.-three { 49 animation: drift 5000ms infinite linear; 50 background: linear-gradient(to bottom, #FE2E9A, #0af); 51} 52 53.wave.-two { 54 animation: drift 7000ms infinite linear; 55 opacity: .1; 56 background: linear-gradient(to bottom, yellow,#A9F5A9); 57} 58 59 60.title { 61 position: absolute; 62 width: 100%; 63 z-index: 1; 64 line-height: 300px; 65 text-align: center; 66 transform: translate3d(0, 0, 0); 67 color: white; 68 text-transform: uppercase; 69 font-family: 'Playfair Display', serif; 70 letter-spacing: .8em; 71 font-size: 24px; 72 text-indent: .5em; 73} 74@keyframes drift { 75 from { transform: rotate(0deg); } 76 from { transform: rotate(360deg); } 77} 78 </style> 79 <body> 80 81<div class='box'> 82 <div class='wave -one'></div> 83 <div class='wave -two'></div> 84 <div class='wave -three'></div> 85 <div class='title'>home</div> 86</div> 87 88<p class="btn6"> 89 <a href="#"> 90 to topaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 91 </a> 92</p> 93 </body> 94</html>
###理想の構図
。 ボックス
左 右
端 端
。 内容
。 ...(他の内容が続く)
どのようなコードに直せば理想の構図のようになるでしょうか?
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。