比混合混合模式更好的选择?

时间:2019-03-12 14:46:44

标签: html css

我的主页有两种背景颜色。我想要的导航栏valueCallback.setValue(..)是,当屏​​幕调整大小,并且导航栏文本进入背景为蓝色的屏幕部分时,我希望将其更改为灰色(相同颜色作为屏幕的另一部分)...

现在,我知道li是一件事情,但是我不喜欢它如何反转颜色...是否可以指定mixed-blend-mode的颜色?还是还有其他选择?

mixed-blend-mode
html, body {
  	margin: 0;
  	padding: 0;
  	/*background-color: #eeeeee;*/
}

div {
	display: block;
}

ul {
	list-style: none;
    list-style-image: none;
    margin: 0;
    padding: 0;
}

a {
	text-decoration: none;
	color: inherit; 
}

#desktop-navbar {
	text-transform: uppercase;
	background-color: transparent;
	width: 100%;
	height: 90px;
	position: fixed;
	z-index:1;
}

#desktop-logo{
	float: left;
}

.logo {
	font-size: 42px;
	font-weight: 300;
	text-transform: uppercase;
	color: #ffffff;
	margin-top: 20px;
	margin-left: 1%;
	font-family: Thasadith;
	font-weight: 700;
	letter-spacing: 3px;
	width: auto;
} 

#desktop-nav-wrapper {
	height: inherit;
	padding: 0 45px;
	font-weight: bold;
	font-size: 18px;
	text-transform: uppercase;
	color: black;
	letter-spacing: 2px;
}

#home {
	height: 700px;
  position: relative;
}

#home-container {
	display: flex;
	height: inherit;
}

#home-content {
	height: auto;
	width: 100%;
	background: linear-gradient(90deg, #314455 63%, #dddddd 0%);
}

#desktop-nav-wrapper nav ul {
	float: right;
	padding-top: 35px;
	font-size: 16px;
}

#desktop-nav-wrapper nav li {
	position: relative;
	display: inline-block;
	padding-left: 35px;
	color: #000000;
	font-family: Thasadith;
	font-weight: 900;
}

1 个答案:

答案 0 :(得分:1)

由于渐变覆盖了整个页面宽度,因此可以使用相反的渐变为文本着色,并使其foreach (DataRowView item in list1.Items.OfType<DataRowView>()) { bool isChecked = Convert.ToBoolean(item["Checked"]); //... } 来模拟更改颜色效果:

fixed
html,
body {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
  list-style-image: none;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

#desktop-navbar {
  text-transform: uppercase;
  background-color: transparent;
  width: 100%;
  height: 90px;
  position: fixed;
  z-index: 1;
}

#desktop-logo {
  float: left;
}

.logo {
  font-size: 42px;
  font-weight: 300;
  text-transform: uppercase;
  color: #ffffff;
  margin-top: 20px;
  margin-left: 1%;
  font-family: Thasadith;
  font-weight: 700;
  letter-spacing: 3px;
  width: auto;
}

#desktop-nav-wrapper {
  height: inherit;
  padding: 0 45px;
  font-weight: bold;
  font-size: 18px;
  text-transform: uppercase;
  color: black;
  letter-spacing: 2px;
}

#home {
  height: 700px;
  position: relative;
}

#home-container {
  display: flex;
  height: inherit;
}

#home-content {
  height: auto;
  width: 100%;
  background: linear-gradient(90deg, #314455 63%, #dddddd 0%);
}

#desktop-nav-wrapper nav ul {
  float: right;
  padding-top: 35px;
  font-size: 16px;
}

#desktop-nav-wrapper nav li {
  position: relative;
  display: inline-block;
  padding-left: 35px;
  color: #000000;
  font-family: Thasadith;
  font-weight: 900;
  /*relevant code*/
  background: linear-gradient(90deg, #dddddd 63%,  #000 0%) fixed;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  /**/
}