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;
  wid.........完整代码请登录后点击上方下载按钮下载查看

网友评论0