Home  >  Article  >  Web Front-end  >  A ribbon effect code implemented with CSS

A ribbon effect code implemented with CSS

零下一度
零下一度Original
2017-04-25 15:09:251949browse

When I was learning css, I wrote a CSS ribbon effect and it felt pretty good. I will introduce it below. Please understand

<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
.ribbon-content {
	border: 1px solid #DDD;
	font-weight: bold;
	margin: 0 -10px;
	min-height: 30px;
	padding: 7px 31px;
	text-align: center;
	line-height: 30px;
}
.ribbon-left {
	display: block;
	border-left: 10px solid white;
	border-top: 8px solid #EEE;
	float: left;
	height: 0;
	margin-left: -10px;
	width: 0;
}
.ribbon-right {
	display: block;
	border-right: 10px solid white;
	border-top: 8px solid #EEE;
	float: right;
	height: 0;
	margin-right: -10px;
	width: 0;
}
</style>
</head>
<body>
<p style="margin: 0 auto; width: 200px;">
	<p class="ribbon" style="background: whiteSmoke;">
		<p class="ribbon-content" style="background: whiteSmoke;">标题</p>
		<p class="ribbon-left"></p>
		<p class="ribbon-right"></p>
	</p>
	<p style="background: whiteSmoke;">内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容</p>
</p>
</body>
</html>

2. [Picture] Capture.JPG          

A ribbon effect code implemented with CSS

The above is the detailed content of A ribbon effect code implemented with CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn