小编Phi*_*rer的帖子

取消设置/删除自定义属性/ CSS变量

请看以下示例:

.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嵌套在其他元素中的任何元素.

html css css3 css-variables

5
推荐指数
1
解决办法
767
查看次数

Spring MVC中有多个@RequestMapping(值,方法对)

我希望用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也会删除用户.

java spring spring-mvc

1
推荐指数
1
解决办法
1173
查看次数

标签 统计

css ×1

css-variables ×1

css3 ×1

html ×1

java ×1

spring ×1

spring-mvc ×1