[英]how to fix the Error at-rule or selector expected
我收到一個錯誤,上面寫着“預期規則或選擇器”我嘗試在末尾添加一個分號,但它不起作用。 請為我推薦一些建議,因為我不知道該怎么做。 我已經嘗試一遍又一遍地檢查我的代碼是否有任何 CSS 錯誤,但似乎沒有,所以我真的不知道這里出了什么問題。
*{
padding-left:10px;
padding-right:10px;
margin:0;
}
.navbar-brand img{
width:150px;
margin-top: -5%;
}
.navbar-brand{
position:absolute;
left:50%;
transform:translateX(-50%);
top:10px;
font-size:7.25rem !important;
}
#navBarSearchForm
{
width: 250px;
font: size 14rem;
}
.banner{
padding-left: 60px;
padding-right:60px;
}
.navbar li ul {
background: lightgrey;
visibility: visible;
opacity: 0;
min-width: 5rem;
position: absolute;
transition: all 0.5s ease;
display: none;
}
/*category hover*/
.navbar li:hover>ul,
ul li:focus-within>ul,
ul li ul:hover,
ul li ul:focus {
visibility: visible;
opacity: 1;
display: inline;
}
.search{
position: relative;
box-shadow: 0 0 40px rgba(51, 51, 51, .1);
}
.search input{
height: 40px;
text-indent: 25px;
border: 2px solid #d6d4d4;
}
.search input:focus{
box-shadow: none;
border: 2px solid blue;
}
.search .fa-search{
position: absolute;
top: 15px;
left: 16px;
}
.search button{
position:absolute;
top: 3px;
right: 5px;
height: 35px;
width: 60px;
background: blue;
}
/*category navbar*/
table, tr , td {
border: none;
border-collapse: collapse;
width: 350px;
padding:2.5px;
background-color: bisque;
}
tr a:hover{
background-color:rgb(149, 240, 149);
}
@media(max-width:786px)
{
.search
{display:none;}
.navbar-brand{
width: 7rem !important;
}
.nav-item {
display:inline-flex;
}
.navbar-brand img{
display:none;
}
}
.footer {
position:fixed;
padding: 10px 10px 0px 0px;
width: 100%;
bottom: 0;
text-align: center;
background-color: black;
color: white;
z-index: 1;
}
@media (max-width: 600px) {
.footer {width: 100%; text-align: center; } }
}//error happens here
你有一個額外的}
替換這個:
@media (max-width: 600px) {
.footer {width: 100%; text-align: center; } }
}//error happens here
有了這個:
@media (max-width: 600px) {
.footer {width: 100%; text-align: center; }
}
我檢查了您的 CSS 並發現了另外一個不需要的半列,以及無效的屬性“字體:大小 14rem;” 這應該是'字體大小:14rem; ' 像這樣。
請檢查更新的 CSS 並讓我知道是否有任何問題。
*{
padding-left: 10px;
padding-right: 10px;
margin: 0;
}
.navbar-brand img{
width: 150px;
margin-top: -5%;
}
.navbar-brand{
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 10px;
font-size: 7.25rem !important;
}
#navBarSearchForm {
width: 250px;
font-size: 14rem;
}
.banner {
padding-left: 60px;
padding-right: 60px;
}
.navbar li ul {
background: lightgrey;
visibility: visible;
opacity: 0;
min-width: 5rem;
position: absolute;
transition: all .5s ease;
display: none;
}
/*category hover*/
.navbar li:hover > ul,
ul li:focus-within > ul,
ul li ul:hover,
ul li ul:focus {
visibility: visible;
opacity: 1;
display: inline;
}
.search{
position: relative;
box-shadow: 0 0 40px rgba(51, 51, 51, .1);
}
.search input{
height: 40px;
text-indent: 25px;
border: 2px solid #d6d4d4;
}
.search input:focus{
box-shadow: none;
border: 2px solid blue;
}
.search .fa-search{
position: absolute;
top: 15px;
left: 16px;
}
.search button{
position: absolute;
top: 3px;
right: 5px;
height: 35px;
width: 60px;
background: blue;
}
/*category navbar*/
table,
tr,
td {
border: none;
border-collapse: collapse;
width: 350px;
padding: 2.5px;
background-color: bisque;
}
tr a:hover {
background-color: rgb(149, 240, 149);
}
.footer {
position: fixed;
padding: 10px 10px 0 0;
width: 100%;
bottom: 0;
text-align: center;
background-color: black;
color: #fff;
z-index: 1;
}
@media(max-width: 786px){
.search {
display:none;
}
.navbar-brand{
width: 7rem !important;
}
.nav-item {
display: inline-flex;
}
.navbar-brand img{
display: none;
}
}
@media (max-width: 600px) {
.footer {
width: 100%;
text-align: center;
}
}
注意:縮進應該是適當的,並且應該避免不必要的高間距和空白。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.