gpt4 book ai didi

html - 用图像替换导航栏颜色

转载 作者:可可西里 更新时间:2023-11-01 13:25:32 25 4
gpt4 key购买 nike

这是导航栏图像的样子:

Navigation Bar Image

代码片段

main nav #wrap {
width: 100%;
height: 50px;
margin: 0;
z-index: 2;
position: relative;
background-color: #3a3a3a; }
main nav #wrap .navbar {
height: 40px;
padding: 0;
margin: 0;
position: absolute; }
main nav #wrap .navbar li {
height: auto;
width: 150px;
float: left;
text-align: center;
list-style: none;
font: normal bold 12px/1.2em Arial, Verdana, Helvetica;
padding: 0;
margin: 0;
top: 20px;
background: #3a3a3a; }
main nav #wrap .navbar a {
padding: 18px 0;
text-decoration: none;
color: white;
display: block; }
main nav #wrap .navbar li:hover, main nav #wrap .navbar a:hover {
background-color: #54879d; }
main nav #wrap .navbar li ul {
display: none;
height: auto;
margin: 0;
padding: 0; }
main nav #wrap .navbar li:hover ul {
display: block; }
main nav #wrap .navbar li ul li {
background-color: #54879d; }
main nav #wrap .navbar li ul li a {
border-left: 1px solid #1f5065;
border-right: 1px solid #1f5065;
border-top: 1px solid #74a3b7;
border-bottom: 1px solid #1f5065; }
<main>
<nav>
<div id="wrap">
<ul class="navbar">
<li><a href="#">Home</a></li>
<li><a href="#">Retrievals</a>
<ul>
<li><a href="#">Data Listing</a></li>
<li><a href="#">Web Scheduling</a></li>
<li><a href="#">Google Maps Application</a></li>
</ul>
</li>
<li><a href="#">Reporting</a>
<ul>
<li><a href="#" >Ad Hoc Report</a></li>
<li><a href="#">Drill Down Report</a></li>
<li><a href="#">Ranking Report</a></li>
</ul>
</li>
<li><a href="#">Business Intelligence</a>
<ul>
<li><a href="#">Business Dashboard</a></li>
<li><a href="#">Web Pivot Table</a></li>
<li><a href="#">Interactive Report</a></li>
<li><a href="#">What-If Analysis</a></li>
</ul>
</li>
<li><a href="#">Data Maintenance</a>
<ul>
<li><a href="#">Database CRUD</a></li>
<li><a href="#">Database Update</a></li>
<li><a href="#">Order Entry</a></li>
<li><a href="#">Drag-and-Drop Application</a></li>
</ul>
</li>
<li><a href="#">B2B Portal</a>
<ul>
<li><a href="#">B2B Portal</a></li>
<li><a href="#">Secure Data-Driven Listings</a></li>
<li><a href="#">Secure Shopping Cart</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</main>

nav bar picture

我有这个导航栏,我正在尝试用上面附加的图像之一替换那个灰色。如您所见,这不是一种简单的颜色。它有小透明点

无论如何我可以复制那种颜色吗?

PS: I do not want to use the image.

最佳答案

正如我在评论中提到的,没有用于添加噪音的 css 方法。但是,您可以通过 base64 编码将图像嵌入到 html 中。我从 this answer 中提取了代码,它是透明的,因此可以涂在任何颜色上。如果您需要不同级别/风格的噪音,那么您必须创建它并对其进行 base64 编码(简单的谷歌搜索会带来很多选择)。

无论如何,希望这对您有所帮助!

main nav #wrap {
width: 100%;
height: 50px;
margin: 0;
z-index: 2;
position: relative;
background-color: #3a3a3a;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/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BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
}
main nav #wrap .navbar {
height: 40px;
padding: 0;
margin: 0;
position: absolute;
}
main nav #wrap .navbar li {
height: auto;
width: 150px;
float: left;
text-align: center;
list-style: none;
font: normal bold 12px/1.2em Arial, Verdana, Helvetica;
padding: 0;
margin: 0;
top: 20px;
background-color: #3a3a3a;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBni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IWiitbnzR794USKBUaT0NTEsVjZqLaFVqJoPN9ODG70IPbfBHKK+/q/AWR0tJzYHRULOa4MP+W/HfGadZUbfw177G7j/OGbIs8TahLyynl4X4RinF793Oz+BU0saXtUHrVBFT/DnA3ctNPoGbs4hRIjTok8i+algT1lTHi4SxFvONKNrgQFAq2/gFnWMXgwffgYMJpiKYkmW3tTg3ZQ9Jq+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==);
}
main nav #wrap .navbar a {
padding: 18px 0;
text-decoration: none;
color: white;
display: block;
}
main nav #wrap .navbar li:hover,
main nav #wrap .navbar a:hover {
background-color: #54879d;
}
main nav #wrap .navbar li ul {
display: none;
height: auto;
margin: 0;
padding: 0;
}
main nav #wrap .navbar li:hover ul {
display: block;
}
main nav #wrap .navbar li ul li {
background-color: #54879d;
}
main nav #wrap .navbar li ul li a {
border-left: 1px solid #1f5065;
border-right: 1px solid #1f5065;
border-top: 1px solid #74a3b7;
border-bottom: 1px solid #1f5065;
}
<main>
<nav>
<div id="wrap">
<ul class="navbar">
<li><a href="#">Home</a></li>
<li><a href="#">Retrievals</a>
<ul>
<li><a href="#">Data Listing</a></li>
<li><a href="#">Web Scheduling</a></li>
<li><a href="#">Google Maps Application</a></li>
</ul>
</li>
<li><a href="#">Reporting</a>
<ul>
<li><a href="#" >Ad Hoc Report</a></li>
<li><a href="#">Drill Down Report</a></li>
<li><a href="#">Ranking Report</a></li>
</ul>
</li>
<li><a href="#">Business Intelligence</a>
<ul>
<li><a href="#">Business Dashboard</a></li>
<li><a href="#">Web Pivot Table</a></li>
<li><a href="#">Interactive Report</a></li>
<li><a href="#">What-If Analysis</a></li>
</ul>
</li>
<li><a href="#">Data Maintenance</a>
<ul>
<li><a href="#">Database CRUD</a></li>
<li><a href="#">Database Update</a></li>
<li><a href="#">Order Entry</a></li>
<li><a href="#">Drag-and-Drop Application</a></li>
</ul>
</li>
<li><a href="#">B2B Portal</a>
<ul>
<li><a href="#">B2B Portal</a></li>
<li><a href="#">Secure Data-Driven Listings</a></li>
<li><a href="#">Secure Shopping Cart</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</main>

关于html - 用图像替换导航栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39161280/

25 4 0