即使我已经在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>

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

dosoo 回答:即使我已经在CSS中设置了背景颜色,大小等,我的按钮仍未格式化

您将按钮视为一个类(在CSS部分中,“按钮”之前有一个点)。您可以写这两个之一:

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

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

在这里,我想向您简要介绍CSS属性是否正常工作。您只需要管理类名称。

.column{
  text-align: center;
}
.column .qwerty {
  background:crimson;
  border: 2px solid #000;
  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;
}

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

,
.column {
  width: 100%;
  text-align: center;
}

使用此。父div必须具有特定的宽度才能使子div居中。

本文链接:https://www.f2er.com/3120156.html

大家都在问