【发布时间】:2016-09-05 03:03:08
【问题描述】:
我想在这两个页面链接的左侧放置一个 SVG 超链接:
该站点使用 Jekyll 并基于 Poole 构建。该站点现在几乎相同,因此可以看到任何其他 CSS 详细信息in Poole's repo
我正在努力解决如何在下面的标头类中放置图像或 svg。我希望徽标与页面导航内联。下面的 img 标签目前什么都不显示。
.masthead {
padding-top: 1rem;
padding-bottom: 1rem;
margin-bottom: 3rem;
}
.masthead-title {
margin-top: 0;
margin-bottom: 0;
color: $gray-4;
}
.masthead-title a {
color: inherit;
}
.masthead-title small {
font-size: 75%;
font-weight: 400;
opacity: .5;
}
<header class="masthead">
<h3 class="masthead-title">
<a href="{{ site.baseurl }}/" title="Home">{{ <img src="/assets/logo_small.svg" height="25" width="100"/> }}</a> <!--site.title-->
{% for page in site.pages_list %}
<small><a href="{{ page[1] }}">{{ page[0] }}</a></small>
{% endfor %}
</h3>
</header>
【问题讨论】:
-
如果您在浏览器中打开开发者工具,是否表明它可以归档 svg 文件?
-
Tangent:通常认为在 CSS 中添加
.masthead-title small {display: inline-block; padding-left: 20px;}之类的东西是更好的做法,而不是使用一堆不间断的空格——这将使您的标记更易于维护,并调整布局会更容易 -
另外,请查看stackoverflow.com/help/mcve 以获取有关如何创建最小、可验证示例的说明,并考虑编辑您提供的代码。由于 SO 无法运行 Liquid,
{{ }}和{% %}函数可以被虚拟内容替换。您可以省略任何与问题不严格相关的 CSS - 在这种情况下,可能会省略所有 CSS,除非在您的测试中您发现存在问题