html - 在另一个类中使用一个类
问题描述
我有以下代码:
.description p span {
font-style: italic;
}
<div class="description">
<p>This recipe is from one of my <span class="cor">favorite</span> cakes out there, really <span>delicious</span>...check it out below</p>
</div>
但我希望第一个跨度标记中的类将所有斜体文本删除为红色
解决方案
使用您为跨度本身提供的类。
.description p span {
font-style: italic;
}
.description .cor {
font-style: normal;
color: red;
}
<div class="description">
<p>This recipe is from one of my <span class="cor">favorite</span> cakes out there, really <span>delicious</span>...check it out below</p>
</div>
推荐阅读
- c# - 在将 Asp.Net WebApi 5.2.2 更新到 5.2.7 后捕获所有不起作用的路由
- php - CURL 返回奇怪的字符
- php - 在这里循环使用 SQL 还是 PHP 更好
- apache-spark - 如何确保 Spark 数据源 v2 中的数据局部性?
- c# - 使用循环c#发送多封电子邮件时出现未指定的错误
- javascript - 带有拖放缩进的 Jquery 可排序
- python - 将交换文件夹擦除到指定大小
- c# - C#如何将图片框的点击事件结合到相应的函数中?
- javascript - 页面重新加载时的Javascript倒计时问题
- reactjs - 如何使用 Office Fabric 和 microsoft graph API 将人员加载为打字