简体   繁体   English

当我添加时,部分样式不起作用<!DOCTYPE html>

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

The style of y "Tweet" button disappears whem i adding !DOCTYPE html.当我添加 !DOCTYPE html 时,y“Tweet”按钮的样式消失了。

Tweet with style有风格的推文

Style gone风格消失了

Css part CSS部分

<!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来自 button.css 的推文按钮的 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 .从您的屏幕截图中,推文按钮的类名是TweetBT ,而在您的button.css中是.tweetBT ,应该是.TweetBT
As the class name is not matching, the CSS is not applied.由于类名不匹配,因此不应用 CSS。 It's not an issue with !DOCType Html.这不是 !DOCType Html 的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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