繁体   English   中英

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

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

当我添加 !DOCTYPE html 时,y“Tweet”按钮的样式消失了。

有风格的推文

风格消失了

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>

来自 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);
}


从您的屏幕截图中,推文按钮的类名是TweetBT ,而在您的button.css中是.tweetBT ,应该是.TweetBT
由于类名不匹配,因此不应用 CSS。 这不是 !DOCType Html 的问题。

暂无
暂无

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

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