css - CSS给出错误: “Expected selector for the style rule”

标签 css css-selectors syntax-error

我正在使用ASP.net Web应用程序,使用以下CSS修改默认的CSS会出现错误:

Expected selector for the style rule



看来是CSS版本问题。我怎么知道我正在使用哪个版本的CSS?我该如何升级?

这是取自Codepen的CSS
$white: #fff;
$google-blue: #4285f4;
$button-active-blue: #1669F2;

.google-btn {
width: 184px;
height: 42px;
background-color: $google-blue;
border-radius: 2px;
box-shadow: 0 3px 4px 0 rgba(0,0,0,.25);
.google-icon-wrapper

{
position: absolute;
margin-top: 1px;
margin-left: 1px;
width: 40px;
height: 40px;
border-radius: 2px;
background-color: $white;
}

.google-icon {
position: absolute;
margin-top: 11px;
margin-left: 11px;
width: 18px;
height: 18px;
}

.btn-text {
float: right;
margin: 11px 11px 0 0;
color: $white;
font-size: 14px;
letter-spacing: 0.2px;
font-family: "Roboto";
}

&:hover {
box-shadow: 0 0 6px $google-blue;
}

&:active {
background: $button-active-blue;
}

}

@import url(https://fonts.googleapis.com/css?family=Roboto:500);

最佳答案

您可以使用以下CSS语法转换语法

检查代码段:

@import url(https://fonts.googleapis.com/css?family=Roboto:500);
.google-btn {
  width: 184px;
  height: 42px;
  background-color: #4285f4;
  border-radius: 2px;
  box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.25);
}
.google-btn .google-icon-wrapper {
  position: absolute;
  margin-top: 1px;
  margin-left: 1px;
  width: 40px;
  height: 40px;
  border-radius: 2px;
  background-color: #fff;
}
.google-btn .google-icon {
  position: absolute;
  margin-top: 11px;
  margin-left: 11px;
  width: 18px;
  height: 18px;
}
.google-btn .btn-text {
  float: right;
  margin: 11px 11px 0 0;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.2px;
  font-family: "Roboto";
}
.google-btn:hover {
  box-shadow: 0 0 6px #4285f4;
}
.google-btn:active {
  background: #1669F2;
}
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
<div class="google-btn">
<div class="google-icon-wrapper">
<img class="google-icon" src="https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg" />
</div>
<p class="btn-text"><b>Sign in with google</b></p>
</div>

关于css - CSS给出错误: “Expected selector for the style rule” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59658325/

相关文章:

python - 在这个非常基本的代码中,我无法弄清楚第6行的语法错误是(python)

html - 焦点输入字段被虚拟键盘遮挡

jquery - 试图让我的 jquery 代码了解我的唯一 ID

css - 我使用 Dreamweaver 创建 Sprite 图像。它在设计/实时 View 中工作,但浏览器不显示图像

ruby-on-rails - rake 分贝 :migrate syntax error when trying to do migration

python - 你好=“bonjour” python2.7的语法错误

javascript - 语法荧光笔不工作

html - 除了一个 :first-child or aside:first-child a?

javascript - 如何在 cytoscape.js 中为单独的 onclick 事件对节点进行分组

java - 单击部分标记内的元素