css - 这段代码可以减少并且仍然具有相同的效果吗?
问题描述
下面的任何代码都是不必要的吗?我认为我在这里有超出要求或未遵循最佳实践的内容。
#button {
color: #fff !important;
text-transform: uppercase;
text-decoration: none;
background: #grey;
padding: 1%;
border-radius: 6px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 350px;
text-align: center;
font-weight: bold;
font-size: 20px;
font-family: Avenir;
cursor: pointer;
border: none;
transition: all 0.4s ease 0s;
z-index: 5;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
}
解决方案
是的,如果使用它可能会更紧凑
margin: 0 auto;
推荐阅读
- python-3.x - 这个独特的 ValueError 发生了什么
- python - 使用 Python 将记录插入 BigQuery 时出错
- r - 根据函数创建数据框列
- python - 如何在 Python 中绘制这样的图?[包括截图]
- r - 从数据表列中满足的条件返回重复值的第一次出现
- javascript - 在网站页脚加载脚本,只有在 Hugo 的特定布局上?
- google-apps-script - 修改已发布的 Google Scripts 应用程序的访问权限不起作用
- css - 是否可以在 Grid.js 中指定 tr 样式?
- makefile - libtool:错误:除非指定了 -no-undefined,否则无法构建 x86_64-w64-mingw32 共享库
- android - Unity如何在Android中获取当前按下的UI按钮