2017-11-10 5 views
0

参考画像に: enter image description here 現在はどのように整列させ、CSSの背景色

必要 enter image description here

ボトムは、トップが私の目標として、または可能に近い私の仕事です。
2つの質問があります。私の部門がページの右側に移動しないのはなぜですか?

私は色とボーダーとH1とdivの中に任意のヘルプを埋めるトラブルを抱えているが
をいただければ幸いですが、ここで私が取り組んできた私のコードで、申し訳ありませんまだCSSやHTMLに新しいイム。

body { 
      background-image: url("bg.jpg"); 
     } 

    div { background-color; #cccccc; 
      opacity: 0.8; 
      padding: 5px; 
      width: 200px; 
      height: 200px; 
      border: 3px ridge #cccccc; 
      padding: 5px 
      margin: 10px 
      position:absolute; 
      right: 0%; 
      top: 0%; 
     } 

    h1 
     {  background-color; #cccccc; 
       padding: 5px; 
       font-weight: bold; 
       font-size: 40px; 
       text-align: center 
       opacity: 0.8; 
       position:absolute; 
       left: 45%; 
       top: 60%; 
       font-family,sans-serif 
       width: 300px;     
     }  




    </style> 
</head> 


<body> 
    <header id="header"> 
    <div class="h1"> 
    <h1 style="color:DarkSlateBlue" text-align: center;>Rythm and Blues</h1> 
    </div> 

    <div> 
    <div class="div"> 
    <h3 style="color:DarkSlateBlue" text-align: center> Artist Name</h3> 
    <p style="color:DarkSlateBlue"> Lorem ipsum dolor sit amet, suas utinam numquam mea ea, errem neglegentur eum ut. Aliquam 
    reformidans et mel. soleat corpora prodesset id quo. ei cibo natum delenit his.</p> 
    </div> 
</body> 

+0

多くのセミコロンがありません。あなたのCSSで。 – gmfm

+0

また、コロンが必要なセミコロンもあります。 – gmfm

+0

もインラインスタイルに引用符がありません。 – gmfm

答えて

0

はコメントに収まらないだろう。以下は、構文のいくつかの修正です。

<style> 
    body { 
      background-image: url("bg.jpg"); 
     } 

    .div { 
      background-color: #cccccc; 
      opacity: 0.8; 
      width: 200px; 
      height: 200px; 
      border: 3px ridge #cccccc; 
      padding: 5px; 
      margin: 10px; 
      position:absolute; 
      right: 0%; 
      top: 0%; 
     } 

    .h1 
     {  background-color: #cccccc; 
       font-weight: bold; 
       font-size: 40px; 
       text-align: center; 
       opacity: 0.8; 
       position:absolute; 
       left: 45%; 
       top: 60%; 
       font-family,sans-serif; 
       width: 300px;     
     }  




    </style> 
</head> 
<body> 
    <div class="h1"> 
     <h1 style="color:DarkSlateBlue;text-align: center;">Rythm and Blues</h1> 
    </div> 

    <div class="div"> 
     <h3 style="color:DarkSlateBlue" text-align: center> Artist Name</h3> 
    <p style="color:DarkSlateBlue"> Lorem ipsum dolor sit amet, suas utinam numquam mea ea, errem neglegentur eum ut. Aliquam 
    reformidans et mel. soleat corpora prodesset id quo. ei cibo natum delenit his.</p> 
    </div> 
</body> 
+0

本当に役立ってくれてありがとう、私はあなたが私を助けて以来、本当に遠くに行ってきました。 divの端を丸める方法と、両方の位置を修正する方法を理解する必要があるので、ブラウザのサイズを変更しても変更されません。 –

+0

https://www.w3schools.com/css/css3_borders.aspあなたは丸い角のための正しい方向にあなた。 – gmfm

+0

パーセンテージの代わりに左からピクセルまたはemの位置を使用して、右の位置は要素を固定したままにする必要があります。 – gmfm