2017-11-07 23 views
2

私は自分のウェブサイトを作ろうとしています。@mediaを使って応答するようになるまではうまくいっていました。さて、私の.topクラスは私のdivには適用されません(特に<div class="top"><h1>Awesurio Home Page</h1></div>を見てください)。実際のWebページに適用されるHTMLとCSSを用意しました。 nav CSSは以前から働いていたので、投稿していません。あなたがそれを望むなら、私はできます。divに基本CSSが適用されていません

h1 { 
 
    color: white; 
 
    text-align: center; 
 
    font-size: 40pt; 
 
    font-family: Arial; 
 
    font-weight: bold; 
 
} 
 

 
p { 
 
    color: #222222; 
 
    font-family: Arial; 
 
    font-size: 16pt; 
 
    img { 
 
    width: 100%; 
 
    height: auto; 
 
    } 
 
    .row:after { 
 
    content: ""; 
 
    clear: both; 
 
    display: table; 
 
    } 
 
    [class*="col-"] { 
 
    float: left; 
 
    padding: 15px; 
 
    width: 100%; 
 
    } 
 
    @media only screen and (min-width: 600px) { 
 
    .col-s-1 { 
 
     width: 8.33%; 
 
    } 
 
    .col-s-2 { 
 
     width: 16.66%; 
 
    } 
 
    .col-s-3 { 
 
     width: 25%; 
 
    } 
 
    .col-s-4 { 
 
     width: 33.33%; 
 
    } 
 
    .col-s-5 { 
 
     width: 41.66%; 
 
    } 
 
    .col-s-6 { 
 
     width: 50%; 
 
    } 
 
    .col-s-7 { 
 
     width: 58.33%; 
 
    } 
 
    .col-s-8 { 
 
     width: 66.66%; 
 
    } 
 
    .col-s-9 { 
 
     width: 75%; 
 
    } 
 
    .col-s-10 { 
 
     width: 83.33%; 
 
    } 
 
    .col-s-11 { 
 
     width: 91.66%; 
 
    } 
 
    .col-s-12 { 
 
     width: 100%; 
 
    } 
 
    } 
 
    @media only screen and (min-width: 768px) { 
 
    .col-1 { 
 
     width: 8.33%; 
 
    } 
 
    .col-2 { 
 
     width: 16.66%; 
 
    } 
 
    .col-3 { 
 
     width: 25%; 
 
    } 
 
    .col-4 { 
 
     width: 33.33%; 
 
    } 
 
    .col-5 { 
 
     width: 41.66%; 
 
    } 
 
    .col-6 { 
 
     width: 50%; 
 
    } 
 
    .col-7 { 
 
     width: 58.33%; 
 
    } 
 
    .col-8 { 
 
     width: 66.66%; 
 
    } 
 
    .col-9 { 
 
     width: 75%; 
 
    } 
 
    .col-10 { 
 
     width: 83.33%; 
 
    } 
 
    .col-11 { 
 
     width: 91.66%; 
 
    } 
 
    .col-12 { 
 
     width: 100%; 
 
    } 
 
    } 
 
    .top { 
 
    background-color: #222222; 
 
    color: #222; 
 
    padding: 10px; 
 
    } 
 
    .menu ul { 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    } 
 
    .menu li { 
 
    padding: 8px; 
 
    margin-bottom: 7px; 
 
    background-color: #33b5e5; 
 
    color: #ffffff; 
 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); 
 
    } 
 
    .menu li:hover { 
 
    background-color: #0099cc; 
 
    } 
 
    .aside { 
 
    background-color: #33b5e5; 
 
    padding: 15px; 
 
    color: #ffffff; 
 
    text-align: center; 
 
    font-size: 14px; 
 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); 
 
    } 
 
    .footer { 
 
    background-color: #222; 
 
    color: #ffffff; 
 
    text-align: center; 
 
    font-size: 12px; 
 
    padding: 15px; 
 
    }
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta name="viewport" content="width=device-width" , initial-scale="1.0"> 
 
    <meta charset="UTF-8"> 
 
    <title>Awesurio</title> 
 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> 
 
    <link rel="stylesheet" href="css/style.css"> 
 
    <link rel="stylesheet" type="text/css" href="css/bodystyle.css"> 
 
</head> 
 

 
<body> 
 
    <div class="header"> 
 
    <div id="container"> 
 
     <div id="burger"> 
 
     <div class="bun top"></div> 
 
     <div class="filling"></div> 
 
     <div class="bun bottom"></div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
    <nav> 
 
    <ul> 
 
     <li> 
 
     <a href="index.html">Home</a> 
 
     </li> 
 
     <li class="green"> 
 
     <a href="projects.html">Projects</a> 
 
     </li> 
 
     <li class="red"> 
 
     <a href="test1.html">test</a> 
 
     </li> 
 
     <li class="yellow"> 
 
     <a href="test2.html">test</a> 
 
     </li> 
 
     <li class="purple"> 
 
     <a href="test3.html">test</a> 
 
     </li> 
 
    </ul> 
 
    </nav> 
 
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
 
    <script src="js/index.js"></script> 
 
    <div class="top"> 
 
    <h1>Awesurio Home Page</h1> 
 
    </div> 
 
    <div class="clearfix"> 
 
    <div class="col-s-12"> 
 
     <p>Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff .Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.Stuff.S tuff.Stuff.Stuff.Stuff.Stuff.Stuff.</p> 
 
    </div> 
 
    </div> 
 
</body> 
 

 
</html>

私は@mediaを追加する前に、これらの両方が働いていたので、多分それは犯人のですか?私は本当にHTMLで始まっているので、簡単に新人の間違いを犯すことができました。

+0

なぜブートストラップ –

+1

なぜでしょうを使用しませんこの場合、ブートストラップを使用しますか? 1つの問題の修正を見つけるだけでなく、他のすべてのWebサイトのように見えるようにするために、余分なページの重さを必要とします。 – Alex

+0

初めて私自身でCSSをやってみたかったのです。 :) – Aureus

答えて

2

あなたのP宣言の行方不明閉じ括弧に追加し、あなたのCSSのタイプミスがあります

p { 
    color: #222222; 
    font-family: Arial; 
    font-size: 16pt; 
} // <- This was missing 

フィドル:

https://jsfiddle.net/cs2hvmnz/1/

+0

ありがとう! – Aureus

関連する問題