2017-06-10 3 views
1
aufgerufen wird

Ich habe eine Klasse erstellt und meine Hintergrundfarbe wird nicht angezeigt. Ich benutze eine andere Klasse und es funktioniert, aber ich möchte meine Logo-Klasse nicht beeinflussen, also habe ich eine Deal-Klasse erstellt.div Hintergrundfarbe wird nicht angezeigt, wenn die Klasse

Hier ist mein HTML-Code:

<!doctype html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <title> 
      Cloud 9 Vapor 
     </title> 
     <meta name="ropots" content="noindex"> 
     <link rel="stylesheet" href = "styles.css" type="text/css" media = "screen" /> 
     <style> 
      .myslides {display:none;} 
     </style> 
    </head> 
    <body id = "bg"> 
     <div class = "logo"> 
      <a href = "index.html"> 
       <img src="cloud-9-vapor-logo-white.png" alt = "Logo for page"> 
      </a> 
     </div> 
      <nav> 
       <ul> 
        <li><a href = "#signup" > Sign Up </a></li> 
        <li><a href = "#member" > Member Login </a></li> 
        <li><a href = "#about" > About </a></li> 
        <li><a href = "#customer" > Customer Service </a></li> 
       </ul> 
      </nav> 
      <br><br><br><br><br><br><br> 
     <div class = "w3-content w3-section" style = "min-width:300px"> 
      <img class = "myslides w3-animate-top" src = "crew.jpg" style = "width:300px" alt = "slide"> 
      <img class = "myslides w3-animate-top" src = "bg.jpg" style = "width: 300px" alt = "slider"> 
    </div> 
    <script> 
    var myIndex = 0; 
    carousel(); 

    function carousel() { 
     var i; 
     var x = document.getElementsByClassName("myslides"); 
     for (i = 0; i < x.length; i++) { 
      x[i].style.display = "none"; 
     } 
     myIndex++; 
     if (myIndex > x.length) {myIndex = 1} 
     x[myIndex-1].style.display = "block"; 
    setTimeout(carousel, 2500); 
    } 
    </script> 
    <br> 
    <div class = "deals"> 
     <p>there should be something here</p> 
    </div> 
</body> 

Hier ist mein CSS-Code:

body{ 
margin: 0; 
} 

ul{ 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    float: right; 
    overflow: hidden; 
    height: 80px; 

} 

li{ 
    float: right; 
    border-right: 1px solid #FFF; 
} 


li a{ 
    display: inline-block; 
    color: #FFF; 
    text-align: center; 
    font-size: 2em; 
    padding: 14px 16px; 
    background-color: #4078A7; 
    text-decoration: none; 
} 

li a:hover{ 
    background-color: #000; 
    color: #4078A7; 
} 

.active{ 
    background-color: #FFF; 
    color: #4078A7; 
} 

#bg{ 
    height: 1000px; 
    background-image: url(webbg.jpg); 
    background-attachment: fixed; 
    background-position: center; 
    background-repeat: no-repeat; 
    background-size: cover; 

} 

.logo{ 
    margin: 0; 
    background-color: #25415E; 
    float: left; 
    box-shadow: 10px 10px 5px 0 black; 
} 

.deals{ 
    position: absolute; 
    width: 70px; 
    float: left; 
    background-color: #25415E; 
    height: 40px; 
} 



@media only screen and (max-width:75em) { 

    ul{ 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    float: right; 
    overflow: hidden; 
    height: auto; 
    } 

li a{ 
display: block; 
color: #FFF; 
text-align: center; 
font-size: 1.09em; 
padding: 8px 10px; 
background-color: #4078A7; 
text-decoration: none; 
} 

#bg{ 
    height: 1550px; 
    background-position: 10% 90%; 
    background-position: left; 
} 


} 
+0

Ihre Website link..let mich senden – Jana

+0

msmith.php.cs.dixie.edu/finalproject – Mychsmit

+0

zu inspizieren erklären erneut, um Ihre Frage ... couldnot die genaue – Jana

Antwort

1

Es funktioniert, aber Sie müssen das Element größer machen für den Text genug Platz haben (da es absolut positioniert)

body{ 
 
margin: 0; 
 
} 
 

 
ul{ 
 
    list-style-type: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    float: right; 
 
    overflow: hidden; 
 
    height: 80px; 
 

 
} 
 

 
li{ 
 
    float: right; 
 
    border-right: 1px solid #FFF; 
 
} 
 

 

 
li a{ 
 
    display: inline-block; 
 
    color: #FFF; 
 
    text-align: center; 
 
    font-size: 2em; 
 
    padding: 14px 16px; 
 
    background-color: #4078A7; 
 
    text-decoration: none; 
 
} 
 

 
li a:hover{ 
 
    background-color: #000; 
 
    color: #4078A7; 
 
} 
 

 
.active{ 
 
    background-color: #FFF; 
 
    color: #4078A7; 
 
} 
 

 
#bg{ 
 
    height: 1000px; 
 
    background-image: url(webbg.jpg); 
 
    background-attachment: fixed; 
 
    background-position: center; 
 
    background-repeat: no-repeat; 
 
    background-size: cover; 
 

 
} 
 

 
.logo{ 
 
    margin: 0; 
 
    background-color: #25415E; 
 
    float: left; 
 
    box-shadow: 10px 10px 5px 0 black; 
 
} 
 

 
.deals{ 
 
    position: absolute; 
 
    width: 240px; 
 
    float: left; 
 
    background-color: #25415E; 
 
    height: 40px; 
 
}
<!doctype html> 
 
<html> 
 
    <head> 
 
     <meta charset="utf-8"> 
 
     <title> 
 
      Cloud 9 Vapor 
 
     </title> 
 
     <meta name="ropots" content="noindex"> 
 
     <link rel="stylesheet" href = "styles.css" type="text/css" media = "screen" /> 
 
     <style> 
 
      .myslides {display:none;} 
 
     </style> 
 
    </head> 
 
    <body id = "bg"> 
 
     <div class = "logo"> 
 
      <a href = "index.html"> 
 
       <img src="cloud-9-vapor-logo-white.png" alt = "Logo for page"> 
 
      </a> 
 
     </div> 
 
      <nav> 
 
       <ul> 
 
        <li><a href = "#signup" > Sign Up </a></li> 
 
        <li><a href = "#member" > Member Login </a></li> 
 
        <li><a href = "#about" > About </a></li> 
 
        <li><a href = "#customer" > Customer Service </a></li> 
 
       </ul> 
 
      </nav> 
 
      <br><br><br><br><br><br><br> 
 
     <div class = "w3-content w3-section" style = "min-width:300px"> 
 
      <img class = "myslides w3-animate-top" src = "crew.jpg" style = "width:300px" alt = "slide"> 
 
      <img class = "myslides w3-animate-top" src = "bg.jpg" style = "width: 300px" alt = "slider"> 
 
    </div> 
 
    <script> 
 
    var myIndex = 0; 
 
    carousel(); 
 

 
    function carousel() { 
 
     var i; 
 
     var x = document.getElementsByClassName("myslides"); 
 
     for (i = 0; i < x.length; i++) { 
 
      x[i].style.display = "none"; 
 
     } 
 
     myIndex++; 
 
     if (myIndex > x.length) {myIndex = 1} 
 
     x[myIndex-1].style.display = "block"; 
 
    setTimeout(carousel, 2500); 
 
    } 
 
    </script> 
 
    <br> 
 
    <div class = "deals"> 
 
     <p>there should be something here</p> 
 
    </div> 
 
</body> 
 

 

 

 
}

Verwandte Themen