简体   繁体   中英

A part of styles didnt work when i add <!DOCTYPE html>

The style of y "Tweet" button disappears whem i adding !DOCTYPE html.

Tweet with style

Style gone

Css part

<!DOCTYPE html>
<html>
    <head>
        <title>Buttons</title>
        <link rel="stylesheet" href="styles/buttons.css">
    </head>
    <body>    
        <button class="buttonYT">SUBSCRIBE</button>
        <button class="JOIN">JOIN</button>
        <button class="Tweetb">Tweet</button>
    </body>

</html>

css part of Tweet button from button.css

.tweetb {
    background-color: rgb(29, 155, 240);
    color: white;
    border: none;
    height: 36px;
    width: 74px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    margin-left: 8px;
    transition: box-shadow 0.15s;
    vertical-align: top;
}

.tweetb:hover {
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.15);
}


From your screenshot, the class name for the tweet button is TweetBT , whereas in your button.css it's .tweetBT , which should be .TweetBT .
As the class name is not matching, the CSS is not applied. It's not an issue with !DOCType Html.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM