目录

操作方法 - 产品卡


了解如何使用 CSS 创建产品卡。


Denim Jeans

精裁牛仔裤

$19.99

一些关于牛仔裤的文字。超薄舒适 lorem ipsum lorem jeansum。 Lorem Jeamsun 牛仔布 lorem jeansum。

亲自试一试 »


如何创建产品卡

步骤1)添加HTML:

示例

<div class="card">
  <img src="jeans3.jpg" alt="Denim Jeans" style="width:100%">
  <h1>Tailored Jeans</h1>
  <p class="price">$19.99</p>
  <p>Some text about the jeans..</p>
  <p><button>Add to Cart</button></p>
</div>


步骤2)添加CSS:

示例

.card {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  max-width: 300px;
  margin: auto;
  text-align: center;
  font-family: arial;
}

.price {
  color: grey;
  font-size: 22px;
}

.card button {
  border: none;
  outline: 0;
  padding: 12px;
  color: white;
  background-color: #000;
  text-align: center;
  cursor: pointer;
  width: 100%;
  font-size: 18px;
}

.card button:hover {
  opacity: 0.7;
}
亲自试一试 »