Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                .container

	.card-module
		.title
			.cat category
			// img size => 16:9
			.cover(style="background-image: url(//picsum.photos/400/225?image=1041)")
		.body
			h2.chapter Card Title
			p.content Lorem ipsum dolor sit amet consectetur adipisicing elit. At soluta harum distinctio voluptatibus temporibus totam consequuntur non rerum beatae earum qui eligendi reiciendis vero ad suscipit voluptas illum, eaque ipsum!
		.footer
			.favor
				// I use jQuery to prepend svg, because codePen can not save file.
				// You can just use img src to replace jQuery prepend function
				.icon.read
					.svg.js-svg-read
					span 12345
				.icon.love
					.svg.js-svg-love
					span 678
			.link
				a(href="") Read

footer
	p
		| Card design concept:
		a(href="https://letswrite.tw/simple-card-ui/", target="_blank") 一個簡單的卡片樣式 simple card ui
              
            
!

CSS

              
                $main: #00BAFF
$main-hover: #008BBF
$grey: #999
$bdrs: 6px
$tran: all ease .5s

*, *::before, *::after
	box-sizing: border-box

html, body, .container
	height: 100%

body
	background: #EEE

.container
	display: flex
	justify-content: center
	align-items: center
	margin: 20px auto
	max-width: 400px
	letter-spacing: .5px

footer
	padding-top: 32px
	padding-bottom: 32px
	text-align: center
	a
		color: $main
		&:hover
			color: $main-hover
	
	
// card style
.card-module
	border-radius: $bdrs
	border-right: 1.5px solid rgba(black, .1)
	border-bottom: 1.5px solid rgba(black, .1)
	
	// title
	.title
		position: relative
		width: 100%
		border-top-left-radius: $bdrs
		border-top-right-radius: $bdrs
	.cat
		position: absolute
		top: 5%
		left: 0
		padding: 2% 12% 2% 2%
		background: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%)
		font-size: 14px
	.cover
		width: 100%
		height: 0
		padding-bottom: 56.25%
		background-position: center center
		background-size: cover
		background-repeat: no-repeat
		border-top-left-radius: $bdrs
		border-top-right-radius: $bdrs
	
	// body
	.body
		padding: 16px
		background: #FFF
		.chapter
			margin-top: 0
			margin-bottom: 8px
			font-size: 24px
		.content
			margin: 0 0 4px
			line-height: 1.25
			font-size: 16px
	
	// footer
	.footer
		position: relative
		display: flex
		padding: 16px
		background: #FFF
		border-bottom-left-radius: $bdrs
		border-bottom-right-radius: $bdrs
		&::before
			content: ''
			position: absolute
			top: 0
			left: 0
			right: 0
			width: 100%
			height: 1px
			background: linear-gradient(to right, rgba(204,204,204,0) 0%,rgba(204,204,204,0) 20%,rgba(221,221,221,1) 50%,rgba(204,204,204,0) 80%,rgba(204,204,204,0) 100%)
	.favor
		display: flex
		justify-content: flex-start
		align-items: center
		width: 75%
	.link
		width: 25%
		text-align: right
	.icon
		display: flex
		font-size: 14px
		&.read
			margin-right: 8px
		.svg, span
			margin-right: 4px
			color: $grey
		svg
			width: 16px
			height: 16px
			path
				fill: $grey
		span
			display: inline-block
	
	.link a
		display: inline-block
		padding: 8px 24px
		border-radius: $bdrs
		text-decoration: none
		color: rgba($main, .87)
		transition: $tran
		&:hover, &:active
			background: rgba($main, .24)
			color: $main-hover
              
            
!

JS

              
                const read = `
	<svg xmlns="http://www.w3.org/2000/svg" width="24.024" height="16" viewBox="0 0 24.024 16">
  	<path fill="#040000" d="M12.012 0C4.075 0 0 8 0 8s3.075 8 12.012 8c8.093 0 12.012-7.969 12.012-7.969S20.075 0 12.012 0zm.018 13c-2.901 0-5-2.188-5-5 0-2.813 2.098-5 5-5s5 2.187 5 5c0 2.812-2.098 5-5 5zm0-8c-1.658.003-3 1.393-3 3 0 1.605 1.342 3 3 3s3-1.395 3-3c0-1.608-1.342-3.003-3-3z"/>
	</svg>
`;

const love = `
	<svg xmlns="http://www.w3.org/2000/svg" width="23.993" height="21.031" viewBox="0 0 23.993 21.031">
  	<path fill="#040000" d="M22.227 10.549c2.355-2.414 2.354-6.325 0-8.737A5.946 5.946 0 0 0 17.863.001c-2.206.038-5.845 3.029-5.845 3.029S8.279-.003 6.018 0a5.93 5.93 0 0 0-4.253 1.812c-2.354 2.413-2.355 6.324 0 8.737l10.231 10.482 10.231-10.482z"/>
	</svg>
`;

$(function() {
	$('.js-svg-read').prepend(read);
	$('.js-svg-love').prepend(love);
});
              
            
!
999px

Console