div+css布局实现咖啡官网代码

代码语言:html

所属分类:布局界面

代码描述:div+css布局实现咖啡官网代码

代码标签: div css 布局 咖啡 官网 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Oswald:wght@400;500;600&family=Roboto:wght@300;400;500&display=swap');
:root {
  --primary: #2A2522;
  --secondary: #936639;
  --light: #F7F3EE;
  --dark: #1A1412;
  --accent: #D4A24E;
  --accent-dark: #B5752E;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

h1, h2, h3, .section-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
}

.logo, .btn, nav ul li a {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
}

body {
  background-color: var(--light);
  color: var(--dark);
  line-height: 1.6;
  letter-spacing: 0.5px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background-color: var(--dark);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--light);
  text-decoration: none;
  display: flex;
  align-items: center;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo span {
  color: var(--accent);
}

nav ul {
  display: flex;
  list-style: none;
}

nav ul li {
  margin-left: 30px;
}

nav ul li a {
  color: var(--light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

nav ul li a:hover {
  color: var(--accent);
}

.cta-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
}

.btn {
  padding: 10px 20px;
  border-radius: 0;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  box-sizing: border-box;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--dark);
  border: none;
}

.btn-primary:hover {
  background-color: #c1914d;
}

.btn-secondary {
  background-color: transparent;
  color: var(--light);
  border: 2px solid var(--light);
}

.btn-secondary:hover {
  background-color: var(--light);
  color: var(--dark);
}

.hero {
  padding: 60px 0;
  display: flex;
  align-items: center;
  background-color: var(--dark);
  color: var(--light);
}

.hero-container {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hero-content {
  flex: 1;
  min-width: 300px;
  max-width: 600px;
}

.hero-image {
  flex: 1;
  min-width: 300px;
  height: 450px;
  position: relative;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  box-shadow: 15px 15px 0 rgba(0,0,0,0.2);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  font-weight: 300;
}

.featured {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 2rem;
}

.section-title:after {
  content: "";
  position: absolute;
  width: 40px;
  height: 2px;
  background-color: var(--accent);
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.product-card {
  background-color: var(--light);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #ddd;
  position: relative;
}

.product-image {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-info {
  padding: 20px;
}

.product-name {
  font-size: 1.3rem;
  margin-bottom: 5px;
  font-style: italic;
}

.product-origin {
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.product-description {
  font-size: 0.9rem;
  margin-bottom: 20px;
  font-weight: 300;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--primary);
}

.about {
  padding: 80px 0;
  background-color: var(--dark);
  color: var(--light);
}

.about-container {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
}

.about-image {
  flex: 1;
  min-width: 300px;
  height: 400px;
  position: relative;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  box-shadow: -15px 15px 0 rgba(0,0,0,0.2);
}

.about-content {
  flex: 1;
  min-width: 300px;
}

.about h2 {
  margin-bottom: 20px;
}

.about p {
  margin-bottom: 20px;
}

.process {
  padding: 80px 0;
}

.timeline {
  margin-top: 50px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  width: 2px;
  background-color: var(--secondary);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  width: 50%;
  box-sizing: border-box;
}

.timeline-item:nth-child(even) {
  left: 50%;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: var(--accent);
  border-radius: 50%;
  top: 20px;
}

.timeline-item:nth-child(odd)::after {
  right: -10px;
}

.timeline-item:nth-child(even)::after {
  left: -10px;
}

.timeline-content {
  padding: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.timeline-content h3 {
  margin-bottom: 10px;
  color: var(--primary);
}

.subscription {
  padding: 80px 0;
  background-color: var(--secondary);
  color: var(--light);
  text-align: center;
}

.subscription h2 {
  margin-bottom: 20px;
}

.subscription p {
  max-width: 600px;
  margin: 0 auto 30px;
}

.subscription-form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
}

.subscription-form input {
  flex: 1;
  padding: 15px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background-color: transparent;
  color: var(--light);
  outline: none;
}

.subscription-form input::placeholder {
  color: rgba(255, 255, 255, 0.8);
  opacity: 1;
}

.subscription-form button {
  padding: 15px 30px;
  background-color: var(--accent);
  color: var(--dark);
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stay-upda.........完整代码请登录后点击上方下载按钮下载查看

网友评论0