【问题标题】:HTML5 website button overlappingHTML5 网站按钮重叠
【发布时间】:2012-12-02 05:54:51
【问题描述】:

我复制了按钮的 css 部分,如果需要更多,请询问。

网址:http://younani.com/finalsite/contactus.html

按钮相互重叠,这是为什么呢?

#left a {font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #ffffff;
    padding: 10px 20px;
    background: -moz-linear-gradient(
        top,
        #ffffff 0%,
        #2a07ed);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#ffffff),
        to(#2a07ed));
    -moz-border-radius: 30px;
    -webkit-border-radius: 30px;
    border-radius: 30px;
    border: 3px solid #ffffff;
    -moz-box-shadow:
        0px 3px 11px rgba(000,000,000,0.5),
        inset 0px 0px 1px rgba(026,020,219,1);
    -webkit-box-shadow:
        0px 3px 11px rgba(000,000,000,0.5),
        inset 0px 0px 1px rgba(026,020,219,1);
    box-shadow:
        0px 3px 11px rgba(000,000,000,0.5),
        inset 0px 0px 1px rgba(026,020,219,1);
    text-shadow:
        0px -1px 0px rgba(000,000,000,0.2),
        0px 1px 0px rgba(255,255,255,0.3);
}





figure{}

#left a:link { background-color: #E6E6E6; }
#left a:visited { background-color: #E6E6E6; }
#left a:hover {border: 3px inset #333333; }

#left ul { list-style-type: none;
          margin: 0;
          padding-left: 0; }

【问题讨论】:

    标签: css html button web


    【解决方案1】:

    按钮重叠是因为锚标记是一个内联元素,因此元素仅根据文本内容位于彼此下方。所以填充会导致它们“重叠”,如果你设置了

    display: block;
    

    在您的 #left a 选择器上,它应该会正确显示。

    【讨论】:

    • 完美!工作得很好,谢谢大卫!
    猜你喜欢
    • 1970-01-01
    • 2021-02-22
    • 1970-01-01
    • 2018-02-23
    • 1970-01-01
    • 2021-05-27
    • 2021-12-30
    • 2019-05-11
    • 2013-06-06
    相关资源
    最近更新 更多