css - 将 svg 图像定位在 span 下
问题描述
我想在一段文本下放置一个 svg 图像。我不想在 svg 中包含一些空间,因为我会将它与各种大小的文本一起使用。
尝试了一堆css样式,但似乎无法得到它。
CSS:
.a_underline{
background: url('~/images/highlight.svg');
background-repeat: no-repeat;
background-size: contain;
padding-bottom: 30px;
}
HTML:
I would like to <span class="a_underline">underline</span> some text
我结束了这个!
希望橙色 svg 低于“下划线”
解决方案
你必须玩background position
设置在底部。检查片段。
.a_underline {
background: url('https://dummyimage.com/200x5/000/fff') bottom center;
background-repeat: no-repeat;
background-size: contain;
padding-bottom: 5px;
}
I would like to <span class="a_underline">underline l ldlvjnlvnnlkk bkbk</span> some text
推荐阅读
- c# - 在 PartialView 中仅查看数据库中包含“Foo”的行
- javascript - 如何解决自定义抽屉组件可触摸 onPress 屏幕切换在 React-Native 中不起作用?
- maven - 类路径上的 UIComponent 两次,应该从哪里导入?
- php - 照亮\广播\广播异常没有消息
- c++ - 为什么某些 STL 函数(例如“find”)不需要“std::”(有时)?
- c# - 带有左连接子查询的 SQL 到 LINQ
- python - 尝试使用 jupyter notebook 中下拉菜单中的值绘制图形
- python - 计算 pandas 数据框中包含 n 个值的行数
- python - Selenium 的 driver.get() 调用的最大递归错误
- angular - 如何在 Angular 7 中使用 chart.js