小编Aar*_*key的帖子

从内部范围覆盖:root CSS变量

在Stack Overflow的设计系统中,我们使用Less来编译CSS颜色值。

我们有类似@orange-500这样的全局Less变量,这些变量经常针对悬停状态,建筑边框样式,背景颜色等进行修改。

在Less中,它写为darken(@orange-500, 5%)。我正在尝试使用本机CSS变量实现类似的目的。切换到CSS变量将使我们能够更快地发布依赖主题的功能(堆栈交换网络,暗模式等),使用更少的CSS行,同时在媒体查询上启用变量交换(高对比度,暗模式等) )。

hsl当变量的作用域为CSS类时,此示例将在工作中覆盖颜色的明度值:

.card {
  --orange: hsl(255, 72%, var(--lightness, 68%));
  background: var(--orange);
}
.card:hover {
  --lightness: 45%;
}
Run Code Online (Sandbox Code Playgroud)
<div class="card">
  Hello world
</div>
Run Code Online (Sandbox Code Playgroud)

但是,我们需要在一个可交换的位置上全局指定颜色变量,以支持全局主题设置,但这并不能按预期工作:

:root {
  --orange: hsl(255, 72%, var(--lightness, 68%));
}
.card {
  background: var(--orange);
}
.card:hover {
  --lightness: 45%;
}
Run Code Online (Sandbox Code Playgroud)
<div class="card">
  Hello world
</div>
Run Code Online (Sandbox Code Playgroud)

我试图从切换:roothtmlbody没有任何的运气。有什么解决方法吗?

css scope css-variables

11
推荐指数
2
解决办法
1080
查看次数

屏幕底部的UIButton只是间歇性地突出显示

我的应用程序主视图底部有一些UIButton.当用户点击它们时,这些按钮会间歇性地突出显示,但总是会调用它们的目标方法.我发现它的控制中心的手势识别器妨碍了UIButton的突出显示.如果我将包含视图向上移动到屏幕中间,则一切都按设计运行.

该问题在此处报告https://devforums.apple.com/message/865922

作为一种解决方法,我尝试使用目标方法手动设置突出显示的状态.这似乎与允许UIButton正常突出显示具有相同的效果.

任何想法如何解决这个问题,而不重新设计这些控件,以显示在应用程序的其他地方?

也许我使用标准视图并手动添加所有触摸交互方法?我该怎么办?它甚至值得探索吗?

objective-c uibutton ios ios7

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

否定填充:currentColor

有没有办法否定或删除fill: currentColor

.svg-icon * {
  /* Targets all sub-elements so we can deliver icons with a color override of our choice */
  fill: currentColor;
}

.svg-icon.iconLogoGlyph * {
  /* How do I  negate fill: currentColor further down the cascade? */
  fill: inherit;
  /* I want the natural colors from the SVG */
}
Run Code Online (Sandbox Code Playgroud)
<svg role="icon" class="svg-icon iconLogoGlyph" width="25" height="30" viewBox="0 0 25 30"><g fill="none"><path fill="#BCBBBB" d="M21 27v-8h3v11H0V19h3v8z"></path><path fill="#F48024" d="M5.402 19.101l13.561 1.96.164-2.38-13.256-2.547-.469 2.967zM7.2 12.3l12 5.6 1.1-2.4-12-5.6-1.1 2.4zm3.4-5.9l10.2 8.5 1.7-2-10.2-8.5-1.7 …
Run Code Online (Sandbox Code Playgroud)

css svg

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

UISearchBar到UISearchDisplayController的转换是20px

我正在UITableView的顶部实现一个UISearchBar.

在我设置的ViewDidLoad中self.edgesForExtendedLayout = UIRectEdgeNone.

这是我如何添加我的UISearchBar.我只是将UISearchBar添加到我的UITableView的标题并调整内容偏移量:

// Table View
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.screenWidth, self.screenHeight)];

self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

// Customize table appearance
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
self.tableView.backgroundColor = [UIColor tableBackgroundColor];

// Define the table's datasource
self.tableView.dataSource = self;
self.tableView.delegate = self;

[self.view addSubview:self.tableView];


// Add a search bar to the header
self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.screenWidth, 44)];
self.searchBar.tintColor = [UIColor primaryBrandedColor];
self.searchBar.placeholder = NSLocalizedString(@"Search", "Search placeholder");
self.searchBar.backgroundImage = [UIImage imageNamed:@"searchBarBackground"];
[self.searchBar setBackgroundImage:[UIImage imageNamed:@"searchBarBackground"] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault]; …
Run Code Online (Sandbox Code Playgroud)

objective-c uisearchbar uisearchdisplaycontroller ios

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