可以尝试使用以下 CSS 代码来美化该 HTML 代码:

body {
  font-family: Arial, sans-serif;
  background-color: #f2f2f2;
}

#root {
  background-color: #fff;
  margin: 20px auto;
  max-width: 600px;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

input[type='text'], input[type='email'], textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 2px solid #ccc;
  border-radius: 5px;
  background-color: transparent;
  color: #333;
}

button {
  background-color: #ccc;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #999;
}

a {
  color: #666;
  text-decoration: none;
}

a:hover {
  color: #333;
  text-decoration: underline;
}

.dark {
  background-color: #333;
  color: #fff;
}

.dark input[type='text'], .dark input[type='email'], .dark textarea {
  border-color: #fff;
  color: #fff;
}

.dark button {
  background-color: transparent;
  border: 2px solid #fff;
}

.dark button:hover {
  background-color: #fff;
}

.dark a {
  color: #fff;
}

.dark a:hover {
  color: #ccc;
}

.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.gap-4 {
  gap: 4px;
}

.mb-2 {
  margin-bottom: 2px;
}

.block {
  display: block;
}

.text-center {
  text-align: center;
}

.text-gray-500 {
  color: #666;
}

.text-xs {
  font-size: 12px;
}

.underline {
  text-decoration: underline;
}

.my-8 {
  margin-top: 8px;
  margin-bottom: 8px;
}

.mt-4 {
  margin-top: 4px;
}

.px-1 {
  padding-left: 10px;
  padding-right: 10px;
}

.p-2 {
  padding: 10px;
}

.h-24 {
  height: 24px;
}

.label {
  font-weight: bold;
}

注意:上面的 CSS 代码只是示例,可以根据个人喜好进行修改和调整。

用 CSS 美化 HTML 代码:评论区样式示例

原文地址: https://www.cveoy.top/t/topic/nJ3K 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录