简体   繁体   English

CSS不适用于div

[英]css not applying on div

I'm trying to apply css to my div (questionFrame) I'm woundering why it is not working? 我正在尝试将CS​​S应用于我的div(questionFrame),我正在为它为什么不起作用感到烦恼? See snippet. 请参见摘要。 Could someone help? 有人可以帮忙吗?

 #questionFrame { border: 5px; border-width: 5px; border-color: black; } 
 <div id="questionFrame"> <span style="color:#0091ea"><p id="date">Date Created</p></span> <div id="userQuestions"></div> <center> <div class="grid-container4"> <a class="waves-effect waves-light btn #00e676 green accent-3" style="width:50%" onclick="grabData()">Proceed</a> <a class="waves-effect waves-light btn #ef5350 red lighten-1 " style="width:50%">Cancel</a> </div> </center> </div> 

The problem is that you have not specified the border style (for example "solid"). 问题是您尚未指定边框样式 (例如“ solid”)。 You can either do these separately: 您可以分别执行以下操作:

#questionFrame {
  border: solid;
  border-width: 5px;
  border-color: black;
}

Or in a single statement: 或在单个语句中:

#questionFrame {
  border: 5px solid black;
}

I would recommend that latter. 我建议后者。

 #questionFrame{ border: 5px solid black; } 
  <div id="questionFrame" > <span style="color:#0091ea"><p id="date">Date Created</p></span> <div id="userQuestions"></div> <center><div class="grid-container4"> <a class="waves-effect waves-light btn #00e676 green accent-3" style="width:50%" onclick="grabData()">Proceed</a> <a class="waves-effect waves-light btn #ef5350 red lighten-1 " style="width:50%">Cancel</a> </div></center> </div> 


OR as your code: 或作为您的代码:

 border: solid;// not 5px border-width: 5px; border-color: black; 

You didn't set any style for your border like border:5px solid; 您没有为边框设置任何样式,例如border:5px solid; or border-style:solid; border-style:solid;

Here you can read more about the border styles: https://www.w3schools.com/css/css_border.asp 在这里您可以阅读有关边框样式的更多信息: https : //www.w3schools.com/css/css_border.asp

Try this 尝试这个

#questionFrame{
border:5px solid #000;
}

Or You can style like this 或者您可以像这样样式

border: solid;
border-width: 5px;
border-color: black;

Did you link it. 您链接了吗? Use 采用

<link rel="stylesheet" href="YourStylesheet.css">

In the head of your html 在你的HTML的头

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM