html - 跨度上的样式也适用于其子跨度

标签 html css

我有一些代码,我想在链接中的父跨度上应用边框,但我的 css 在两个跨度上都应用了 css 样式?

<div id="DownloadButton">
    <a href="DownloadMovie.php/?FileName=Assignment 1- Regular Expression (2).docx&MovieID=2179136">    
        <span>
            <span class="glyphicon glyphicon-download-alt" aria-hidden="true" style="float:left;">
            </span>
                Assignment 1- Regular Expression (2).docx
        </span>
    </a>
</div>

我的CSS代码

#DownloadButton a span{
    font-size: 13px;
    display:inline-block;
    font-weight: bold;
    width:auto;
    padding:0px 10px 0px 0px;
    border-radius: 05px 5px 05px 05px;
    border:1px solid red;
}

我的输出图像 http://i58.tinypic.com/amea00.png

最佳答案

用子选择器指定:

#DownloadButton a > span {

关于html - 跨度上的样式也适用于其子跨度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29151635/

相关文章:

jQuery 滚动到

javascript - 水平扩展的 HTML 输入字段

css - 在 Chrome 的 Web 检查器中显示 css 注释

html - 使用 Markdown 输入化学式

html - 背景图像 css 不显示

html - WP即footer不在底部

javascript - 一个长字的文字换行

html - 如何将表格从 html 完全复制到 MS Word?

javascript - 使一个(图像)向右移动并旋转 45 度,同时将鼠标悬停在另一个(图像)上

javascript - 替换折叠固定标题中的图像(滚动) - javascript