请看以下示例:
.article, .note {
color: var(--text-color, red);
}
.theme {
--text-color: blue;
}
.theme .note {
--text-color: unset;
}Run Code Online (Sandbox Code Playgroud)
<section>
<p class="article">Article</p>
<p class="note">Note</p>
</section>
<section class="theme">
<p class="article">Article</p>
<p class="note">Note</p>
</section>Run Code Online (Sandbox Code Playgroud)
是否可以通过取消设置CSS变量使第二个"注"再次变为红色?
我知道我只能应用CSS变量,.article但我假设我有很多类似的元素,我希望应用主题,但只有少数豁免.然后维护选择器会相当繁琐.
我可以将主题选择器更改为.theme :not(.note)但不适用于.note嵌套在其他元素中的任何元素.
我希望用Spring MVC实现这样的功能
@RequestMapping(value = "/user/{userId}", method = RequestMethod.DELETE)
@RequestMapping(value = "/user/{userId}/delete", method = RequestMethod.POST)
public void deleteUser(@PathVariable String userId) {
...
}
Run Code Online (Sandbox Code Playgroud)
这将为我提供REST调用和标准HTML表单帖子的通用端点.是否可以使用Spring MVC?我能想出的就是
@RequestMapping(value = { "/user/{userId}", "/user/{userId}/delete"}, method = {RequestMethod.DELETE, RequestMethod.POST})
public void deleteUser(@PathVariable String userId) {
...
}
Run Code Online (Sandbox Code Playgroud)
但结果略有不同,因为对"/ user/{userId}"的POST也会删除用户.