Home > Web Front-end > HTML Tutorial > css after before制作的边三角提示框

css after before制作的边三角提示框

WBOY
Release: 2016-06-01 09:53:30
Original
1603 people have browsed it

上三角提示框(使用after伪类元素,当然也可以使用before伪类元素):

<code class="language-html">

    <title>css after before制作的边三角提示框</title>
    <style type="text/css">
		.arrow_box {
			position: relative;
			background: #88b7d5;
			border: 1px solid #c2e1f5;
			padding: 10px;
			width: 200px;
			height: 100px;
			border-radius: 6px;
			box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
			margin: 30px;
			float: left;
		}
		.arrow_box::after{
			position:absolute;
			content:"";
			height:0;
			width: 0;
			pointer-events: none;
			border: solid transparent;
			border-color: rgba(136, 183, 213, 0);
			border-bottom-color: #88b7d5;
			border-width: 10px;
			left: 50%;
			margin-left: -10px;
			bottom: 100%;
		}
    </style>


<div class="arrow_box"></div>

</code>
Copy after login

效果图:

css after before制作的边三角提示框

左三角提示框:

<code class="language-html">

    <title>css after before制作的边三角提示框</title>
    <style type="text/css">
		.arrow_box {
			position: relative;
			background: #88b7d5;
			border: 1px solid #c2e1f5;
			padding: 10px;
			width: 200px;
			height: 100px;
			border-radius: 6px;
			box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
			margin: 30px;
			float: left;
		}
		.arrow_box::before{
			position:absolute;
			content:"";
			height:0;
			width: 0;
			pointer-events: none;
			border: solid transparent;
			border-color: rgba(136, 183, 213, 0);
			border-right-color: #88b7d5;
			border-width: 10px;
			top: 50%;
			right: 100%;
			margin-top:-10px;
		}
    </style>


<div class="arrow_box"></div>

</code>
Copy after login

效果图:

css after before制作的边三角提示框

同样,利用上面的实例也可以制作右三角提示框和下三角提示框。这里不再写实例了,读者可以自己尝试一下。

如果需要更多样式的边三角提示框,可以访问这个网站:http://cssarrowplease.com/

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template