首页 > 解决方案 > 即使我已经在 css 中设置了背景颜色、大小等,我的按钮也没有格式化

问题描述

我正在制作一个网站,我正在尝试使按钮中心对齐,无边框,但是,css 代码似乎不会影响网站

我尝试过更改类名,更改代码等。在浏览器(谷歌浏览器)上,它显示代码在样式上被“识别”但未被读取

.qwerty {
  background:#f4511e;
  border: none;
  color: white;
  padding: 16px 32px;
  text-align: center;
  font-size: 16px;
  margin: 4px 2px;
  opacity: 0.6;
  transition: 0.3s;
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {opacity: 1}
<div class="column" class="Border">
	<form action="aboutme.html">
	<button class="qwerty">ABOUT ME</button>
	</form>
</div>

按钮应该没有边框,橙色,并且在悬停时增加不透明度

标签: htmlcssbutton

解决方案


您将按钮视为一个类(在“按钮”之前有一个点的 CSS 部分中)。您可以编写以下两种中的任何一种:

// First solution
.qwerty:hover {opacity: 1}

//Second solution
button:hover {opacity: 1}

推荐阅读