html - 在 CSS 中为超链接缩进

标签 html css

如何让超链接缩进? 我试过这个代码但没有成功。

a {
  text-decoration: none;
  text-indent: 20px;
}
 <a href="#h"> html </a>

最佳答案

如果您不希望所有超链接都缩进,您可以将其包裹在<div> 周围。具有唯一标识;这是另一种解决方案。

HTML:

<div id="indented">
    <a href="#h"> html </a>
</div>

CSS:

a{
    text-decoration:none;
}

#indented {

    text-indent:20px;

}

关于html - 在 CSS 中为超链接缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41515092/

相关文章:

jquery - 为什么 $ ('#foo' ).css ('width' , $ ('#foo' ).css ('width' )) 改变宽度?

html - CSS 的布局中性标签?

javascript - 有人知道为什么这个 Canvas 不起作用吗?

javascript - 阻止 div 滑过页面顶部

HTML 标记添加冗余 <a> 标签 <div>?

jquery - 如何使用带有 fadeIn 和 fadeOut 的 jquery 制作图像 slider

html - 从 CSS/HTML 中的 div 创建一个 'Table'

javascript - iframe insideHTML 为空

javascript - 如何在不影响行的情况下将 margin-top 设置为元素?

javascript - 如何使用 .css 添加类并添加删除类或更改属性?