Home > Web Front-end > HTML Tutorial > Border with triangle notch_html/css_WEB-ITnose

Border with triangle notch_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:53:38
Original
1522 people have browsed it

When I used to read comics, if there was dialogue, there would usually be a border with a triangle leading out from the speaker. Similar to the picture below:

There should be many ways to achieve it. The method provided here is to create a border and then cover it with two triangles. The effect is as follows:

In order to facilitate understanding, I added a black background to the body, as follows:

The code is as follows:

<!doctype html><html><head><meta charset="UTF-8"><title>带三角缺口的边框</title><style>.out {    display:block;    width:0;    height:0;    border-left:6px dashed transparent;    border-right:6px dashed transparent;    border-top:0;    border-bottom:7px solid #ccc;    position:relative;    top:-7px;    left:50%;}.inner {    position:absolute;    border-left:6px dashed transparent;    border-right:6px dashed transparent;    border-top:0;    border-bottom:7px solid #fff;    left:-6px;    top:2px;}div {    position:relative;    margin:0 auto;    width:80px;    height:100px;    border:1px solid #ccc;    border-radius:5px;}    </style></head><body><div><span class="out">    <span class="inner"></span></span></div></body></html>
Copy after login

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