gpt4 book ai didi

html - 引导按钮中的图像随背景颜色而不是按钮颜色而变化

转载 作者:行者123 更新时间:2023-11-28 16:02:33 27 4
gpt4 key购买 nike

我正在尝试应用我在 forkawesome ( https://forkaweso.me/Fork-Awesome/icon/discord/ ) 上创建的不和谐 Logo

我的代码遇到了一个恼人的问题,因为我试图将不和谐 Logo 放在一个按钮中,但每次背景都会发生变化,但其中一个按钮不会发生变化:

image

(我滥用图标的大小来显示确切的问题是什么)

起初我也尝试过使用 .jpg 格式的图像来代替,但是当我将鼠标悬停在按钮上时,您可以看到图像的白色背景

      <div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" name="password" required>
</div>
<button type="submit" name="submit" class="btn btn-default">Login</button>
<a href="scripts/discordLogin.php" class="btn btn-default">Discord Login <span class="fa fa-discord fa-5x" aria-hidden="true" ></span></a>
</form>
</div>

如果可以简单地让 Logo 随着按钮颜色的变化而变化,那就太棒了!

(评论中询问的 jsfiddle https://jsfiddle.net/9fmrwyje/ )

最佳答案

这是你想要的吗?

* {
font-family: arial;
background-color: #2a3752;
color: #dcd1d1;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

body {
background-color: #2a3752;
}

.discord-logo-btn .fa-discord {
background: #fff;
}

.discord-logo-btn:hover .fa-discord, .discord-logo-btn:focus .fa-discord {
background: #e6e6e6;
}
<!DOCTYPE html>


<html>

<head>
<meta http-equiv='content-type' content='text/html;charset=utf-8' />
<title>Login</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css" integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY=" crossorigin="anonymous">
<link rel="icon" type="image/png" href="images/128.png" />
<title>Login - JAPC Web management panel</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>

<body>
<div class="container">
<div style="display: flex; justify-content: center;">
<img src="images/128.png" alt="Join and play coop logo" align="middle">
</div>
<h3 class="text-center">JAPC Web Management panel login</h3>
<form action="" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" name="password" required>
</div>
<button type="submit" name="submit" class="btn btn-default">Login</button>
<a href="scripts/discordLogin.php" class="discord-logo-btn btn btn-default">Discord Login <span class="fa fa-discord fa-5x" aria-hidden="true" ></span></a>
</form>
</div>
</body>

</html>

关于html - 引导按钮中的图像随背景颜色而不是按钮颜色而变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57588484/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com