【问题标题】:How to make the text inside of a div glow whenever you hover over the div每当您将鼠标悬停在 div 上时,如何使 div 内的文本发光
【发布时间】:2023-03-11 16:38:02
【问题描述】:

好的,我有这个导航栏,它包含一系列 5 个 div,其中包含文本。我想让它到达每当我将鼠标悬停在 div 上时,div 内的 <p> 元素就会发光。我知道所有正确的 css 标签来获得发光等,但是当涉及到 (div):hover { } css 标签时我很难过,因为我希望它们里面的文本发光,而不是整个分区。这是您需要的代码。

HTML

<div id="navBar">
    <a class="navLinks" href="#"> <!-- Replace the # with your url or directory link, keep the "" around it. -->
        <div class="navButtonsNorm" id="n1">
            <p class="navTextNorm">Donate</p><!-- Replace the text between the <p></p> tags with your own link names. -->
    </div>
    </a>
    <a class="navLinks" href="#"> <!-- Replace the # with your url or directory link, keep the "" around it. -->
        <div class="navButtonsNorm" id="n2">
            <p class="navTextNorm">Contact Me</p><!-- Replace the text between the <p></p> tags with your own link names. -->
        </div>
    </a>
    <a class="navLinks" href="#"> <!-- Replace the # with your url or directory link, keep the "" around it. -->
        <div class="navButtonsNorm" id="n3">
            <p class="navTextNorm">Portfolio</p><!-- Replace the text between the <p></p> tags with your own link names. -->
        </div>
    </a>
    <a class="navLinks" href="#"> <!-- Replace the # with your url or directory link, keep the "" around it. -->
        <div class="navButtonsNorm" id="n4">
            <p class="navTextNorm">About me</p><!-- Replace the text between the <p></p> tags with your own link names. -->
        </div>
    </a>
    <a class="navLinks" href="#"> <!-- Replace the # with your url or directory link, keep the "" around it. -->
        <div class="navButtonsNorm" id="n5">
            <p class="navTextNorm">Home</p> <!-- Replace the text between the <p></p> tags with your own link names. -->
        </div>
    </a>
</div>

CSS

.navButtonsNorm {
    width:150px;
    height:50px;
    border-right:1px inset black;
    float:right;
    background: rgba(254,254,254,1);
    background: -moz-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(240,240,240,1) 47%, rgba(219,219,219,1) 52%, rgba(226,226,226,1) 100%);
    background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(254,254,254,1)), color-stop(47%, rgba(240,240,240,1)), color-stop(52%, rgba(219,219,219,1)), color-stop(100%, rgba(226,226,226,1)));
    background: -webkit-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(240,240,240,1) 47%, rgba(219,219,219,1) 52%, rgba(226,226,226,1) 100%);
    background: -o-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(240,240,240,1) 47%, rgba(219,219,219,1) 52%, rgba(226,226,226,1) 100%);
    background: -ms-linear-gradient(top, rgba(254,254,254,1) 0%, rgba(240,240,240,1) 47%, rgba(219,219,219,1) 52%, rgba(226,226,226,1) 100%);
    background: linear-gradient(to bottom, rgba(254,254,254,1) 0%, rgba(240,240,240,1) 47%, rgba(219,219,219,1) 52%, rgba(226,226,226,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe', endColorstr='#e2e2e2', GradientType=0 );
}
.navTextNorm {
    font-family:CODE Light;
    font-size:24px;
    color:black;
    -webkit-text-stroke:1px;
    text-align:center;
    margin-top:15px;
}
.navLinks {
    text-decoration:none;
}
.navLinks:hover{

}

谢谢,如果你能帮忙的话。

【问题讨论】:

    标签: html text hover navbar glow


    【解决方案1】:

    这是你的意思吗?

    .navLinks:hover{
        text-shadow:0 0 5px #ff0000;
    }
    

    其中的零点是 x 和 y 偏移量,然后是模糊的大小,然后是颜色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-26
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      • 2014-08-07
      • 1970-01-01
      相关资源
      最近更新 更多