Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
	<div class="header">
		<h1><a href="#"><img class="logo" src="https://hexschool.github.io/webLayoutTraining1st/student-week1/logo-all-dark.svg?raw=true" alt="logo"></a></h1>
		<ul class="main">
			<li><a href="#">首頁</a></li>
			<li><a href="#">甜點</a></li>
			<li><a href="#">登入</a></li>
			<li class="icon">
				<a href="#"><img src="https://hexschool.github.io/webLayoutTraining1st/student-week1/shopping_cart.png?raw=true" alt="shoppingcar"></a>
			</li>
		</ul>
	</div>
	<div class="banner">
		<img src="https://hexschool.github.io/webLayoutTraining1st/student-week1/banner.png" alt="banner">
	</div>
	<div class="content">
		<ul class="menu">
			<!-- 	menu需使用ul li製作	 -->
			<li class="menu-title"><a href="#"><h2>甜點類別</h2></a></li>
			<li class="menu-info"><a href="#">所有甜點 (48)</a></li>
			<li class="menu-info"><a href="#">本日精選 (10)</a></li>
			<li class="menu-info"><a href="#">人氣推薦 (26)</a></li>
			<li class="menu-info"><a href="#">新品上市 (12)</a></li>
		</ul>
		<ul class="items">
			<li class="item-box">
				<div class="img-box">
					<img src="https://hexschool.github.io/webLayoutTraining1st/student-week1/p-1.png" alt="img">
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="border">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
			<li class="item-box">
				<div class="img-box">
					<div class="product">
					<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/p-2.png" alt="img-2">
					</div>
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="icon">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
			<li class="item-box">
				<div class="img-box">
					<div class="product">
					<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/p-3.png" alt="img-3">
					</div>
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="icon">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
			<li class="item-box">
				<div class="img-box">
					<div class="product">
					<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/p-4.png" alt="img-4">
					</div>
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="icon">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
			<li class="item-box">
				<div class="img-box">
					<div class="product">
					<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/p-5.png" alt="img-5">
					</div>
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="icon">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
			<li class="item-box">
				<div class="img-box">
					<div class="product">
					<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/p-6.png" alt="img-6">
					</div>
					<div class="tag">
						<p>本日精選</p>
					</div>
					<div class="like">
						<img src="https://raw.githubusercontent.com/hexschool/webLayoutTraining1st/master/student-week1/favorite_border.png" alt="icon">
					</div>
				</div>
				<div class="title">
					<div class="name"><h3>焦糖馬卡龍</h3></div>
					<div class="price">NT$ 450</div>
				</div>
				<a href="#" class="buy">加入購物車</a>
			</li>
		</ul>
	</div>
	
	<ul class="page">
		<li><a href="#"><i class="fas fa-caret-left"></i></a></li>
		<li class="number"><a href="#">1</a></li>
		<li class="number"><a href="#">2</a></li>
		<li class="number"><a href="#">3</a></li>
		<li><a href="#"><i class="fas fa-caret-right"></i></a></li>
	</ul>
</div>
              
            
!

CSS

              
                
body {
  font-family: "PingFang TC", "Semibold","Noto Sans CJK TC", "Microsoft JhengHei";
}

a{
	text-decoration:none;
}

.container{
	width:940px;
	margin: 0 auto;
}

.header{
	display:flex;
	justify-content:space-between;
	align-items:center;
	margin: 30px 0px;
}

.logo{
	width: 300px;
	height: 58px;
}

.main{
	display:flex;
	align-items:center;
}

.icon{
    margin-left: 19px;
}
.main li a {
    margin-left: 60px;
}

.main li a{
	font-size:16px;
	font-weight:bold;
	text-decoration:none;
	color: #3F5D45;
	display:block;
}


.banner img{
	width:100%;
	object-fit: cover;
}

.content{
	margin-top:60px;
	display:flex;
	justify-content:space-between;
}

.menu-title a{
		padding:16px 64px;
}

.menu li{
	text-align:center;
	border:1px solid #EAF0ED ;
}

.menu-info a{
	padding:16px 64px;
	text-decoration:none;
	font-size: 24px;
	font-weight:bold;
	color:#3F5D45;
	display:block;
}

.menu > li:nth-child(2){
	background-color: #EAF0ED;
}

.menu-info a:hover{
	color: #3F5D45;
	background: #EAF0ED;
	transition: .3s ease-in-out;
}

.menu-title{
	background:#3F5D45;
}

.menu-title a{
	text-decoration:none;
}

.menu-title a h2{
	color:white;
	text-decoration:none;
	font-size: 24px;
	font-weight:bold;
}

.items{
	display:flex;
	flex-wrap:wrap;
	/* 限制寬度,分配空間 */
	width: 620px;
	justify-content: space-between;
}

.item-box{
	margin-bottom: 20px;
}

.title{
	display:flex;
}

.img-box{
	position:relative;
}

.tag{
	position: absolute;
  top: 0px;
  left: 20px;
  writing-mode: vertical-rl;
  padding: 10px;
  letter-spacing: 5px;
	color:white;
	background: #3F5D45;
}

.like{
	position: absolute;
  top: 19px;
  right: 22px;
}

.title{
	display:flex;
	justify-content:center;
	border:1px solid #EAF0ED;
}

.name,.price{
	padding:20px;
	color: #3F5D45;
	font-size:20px;
}

.name{
	margin:0 17px;
}

.price{
	font-weight:bold;
	border-left: 1px solid #EAF0ED;
}

.buy {
	background: #EAF0ED;
	padding:16px 90px;
	text-decoration:none;
	font-size:24px;
	color:#3F5D45;
	font-weight:bold;
	display:block;
}

.buy:hover{
	color:white;
	background: #3F5D45;
	transition: .3s ease-in;
}

.img-box img{
	vertical-align: middle;
}

.page{
	display:flex;
	justify-content:flex-end;
	margin-top:10px;
}

.page li{
	border: 1px solid #EAF0ED;
}

.page li a{
	text-decoration:none;
	font-size: 20px;
	font-weight: bold;
	color: #3F5D45;
	display:block;
	padding: 20px 25px;
}

.number a:hover,.page li a:hover{
	background: #3F5D45;
	color:white;
	transition: .4s ease-out;
}
              
            
!

JS

              
                
              
            
!
999px

Console