Home >Web Front-end >HTML Tutorial >这两个CSS定义的效果怎么不一样呢?_html/css_WEB-ITnose

这两个CSS定义的效果怎么不一样呢?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:46:591020browse

css 透明效果 div

定义1:
.div_transparent, .div_time, .div_rpt_now, . div_suggestion,. div_ap_item
{
    text-align: center;
    filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */
    opacity: 1.0; 
    background:#ccc; 
}

.div_ap_item
{
   top: 10px;
    left: 5px;
    height: 80px;
    width: 90px;
    line-height: 20px;
    font-size: small;
    color: #006600;
    font-family: 微软雅黑;
    text-align: center;
}

定义2:
.div_ap_item
{
    text-align: center;
    filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */
    opacity: 1.0; 
    background:#ccc; 
}

.div_ap_item
{
   top: 10px;
    left: 5px;
    height: 80px;
    width: 90px;
    line-height: 20px;
    font-size: small;
    color: #006600;
    font-family: 微软雅黑;
    text-align: center;
}

我一直认为这两种定义方式的效果应该是一样的,奇怪的是,定义1可以产生透明效果;定义2却没有
怎么回事呢?

回复讨论(解决方案)

.div_transparent, .div_time, .div_rpt_now, . div_suggestion, . div_ap_item

注意空格

.div_transparent, .div_time, .div_rpt_now,  .div_suggestion,  .div_ap_item

大哥
你的定义1里面“. div_ap_item”明显有个空格啊

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn