在HTML中是否有透明颜色代码? [英] Is there a color code for transparent in HTML?

查看:1792
本文介绍了在HTML中是否有透明颜色代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个新网站,并且正在寻找一个透明的导航栏,以便可以看到背景。 解决方案

没有透明颜色代码,但有不透明度样式。在 developer.mozilla.org 上查看关于它的文档。



您可能需要设置元素的颜色,然后将不透明度应用于元素。

  .transparent-style {

background-color:#ffffff;
不透明度:.4;


$ / code>

你可以使用一些在线透明产品,这也会给你浏览器特定的风格。例如看看 http://www.css-opacity.pascal-seven.de/



请注意,当您设置元素的透明度时,任何子元素也会变为透明。所以你真的需要覆盖任何其他元素。



您可能还想尝试使用Alpha(A)设置使用RGBA颜色来更改不透明度。例如

  .transparent-style {
background-color:rgba(255,255,255,.4);
}

opacity上使用RGBA 表示您的子元素不透明。


I'm building a new website, and I'm looking for a transparent navigation bar so the background is visible.

解决方案

There is not a Transparent color code, but there is an Opacity styling. Check out the documentation about it over at developer.mozilla.org

You will probably want to set the color of the element and then apply the opacity to it.

.transparent-style{

    background-color: #ffffff;
    opacity: .4;

}

You can use some online transparancy generatory which will also give you browser specific stylings. e.g. take a look at http://www.css-opacity.pascal-seven.de/

Note though that when you set the transparency of an element, any child element becomes transparent also. So you really need to overlay any other elements.

You may also want to try using an RGBA colour using the Alpha (A) setting to change the opacity. e.g.

.transparent-style{
    background-color: rgba(255, 255, 255, .4);
}

Using RGBA over opacity means that your child elements are not transparent.

这篇关于在HTML中是否有透明颜色代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆