如果我有文本,div的渐变背景不会出现?

时间:2021-05-10 20:22:23

I'm trying to make tags for an Enjin website (Two, actually). I'm trying to make a gradient with a gradiented text inside it, but it isn't working. This is my code:

我正在为Enjin网站做标签(实际上是两个)。我试着在它里面设置一个渐变的文本,但是它不起作用。这是我的代码:

#ownerheaven {
    width: 120px;
    height: 30px;
    background: linear-gradient(#00A6FF, #0033FF);
    border-radius: 60px;
}
#owner_heaven_text {
    font-size: 20px;
    padding: 0;
    margin: 0;
}
<div id="container">
    <div id=" heaven"></div>
        <div id="owner_heaven">
            <h1 id="owner_heaven_text">OWNER</h1>
        </div>
    <div id="dragon">
        <div id="owner_dragon"></div>
    </div>
</div>

Thanks in advance for any help :)

感谢您的帮助:)

1 个解决方案

#1


3  

You forgot a _ in your CSS for #owner_heaven.

你忘了在你的CSS里有#owner_heaven。

#owner_heaven {
    width: 120px;
    height: 30px;
    background: linear-gradient(#00A6FF, #0033FF);
    border-radius: 60px;  
}
#owner_heaven_text {
    font-size: 20px;
    padding: 0;
    margin: 0;
}
<div id="container">
    <div id=" heaven"></div>
        <div id="owner_heaven">
            <h1 id="owner_heaven_text">OWNER</h1>
        </div>
    <div id="dragon">
        <div id="owner_dragon"></div>
    </div>
</div>

#1


3  

You forgot a _ in your CSS for #owner_heaven.

你忘了在你的CSS里有#owner_heaven。

#owner_heaven {
    width: 120px;
    height: 30px;
    background: linear-gradient(#00A6FF, #0033FF);
    border-radius: 60px;  
}
#owner_heaven_text {
    font-size: 20px;
    padding: 0;
    margin: 0;
}
<div id="container">
    <div id=" heaven"></div>
        <div id="owner_heaven">
            <h1 id="owner_heaven_text">OWNER</h1>
        </div>
    <div id="dragon">
        <div id="owner_dragon"></div>
    </div>
</div>