Sample code for achieving small triangle border effect with pure CSS3+DIV

Sample code for achieving small triangle border effect with pure CSS3+DIV

The specific code is as follows:

The html code is as follows <div class="arrow-up">
     <!--Upward triangle-->
</div>
<div class="arrow-down">
    <!--Downward triangle-->
</div>
<div class="arrow-left">
    <!--Left-pointing triangle-->
</div>
<div class="arrow-right">
    <!--Rightward triangle-->
</div>
 
Below we use CSS3 to implement the upward, downward, left and right triangles respectively /*arrow up*/
.arrow-up {
    width:0;
    height:0;
    border-left:30px solid transparent;
    border-right:30px solid transparent;
    border-bottom:30px solid #fff;
}
    
 /*arrow down*/
.arrow-down {
    width:0;
    height:0;
    border-left:20px solid transparent;
    border-right:20px solid transparent;
    border-top:20px solid #0066cc;
}
    
 /*Arrow pointing left*/
.arrow-left {
    width:0;
    height:0;
    border-top:30px solid transparent;
    border-bottom:30px solid transparent;
    border-right:30px solid yellow;
}
   
/*arrow right*/
.arrow-right {
    width:0;
    height:0;
    border-top:50px solid transparent;
    border-bottom: 50px solid transparent;
    border-left: 50px solid green;
}

Mini Program Example

wxml

<view class="index_sale_lists">
      <view class="sanjiao"></view>
      <view class="index_sale_list">
        <view class="index_sale_choice">You have chosen: <text>Shangnao</text></view>
        <view class="index_sale_tezhi">
          <text>
            Characteristics: Beef topside is located at the back of the shoulder and neck, on both sides of the spine. The meat is tender and juicy, the fat is evenly distributed, and it has beautiful marble patterns. It has a soft texture and melts in the mouth. It is low in fat and high in protein. It is suitable for hot pot, and can be fried, deep-fried and grilled.
          </text>
        </view>
      </view>
    </view>

wxss

.index_sale_lists{
  margin: 50rpx 24rpx 0;
  background-color: #F2F6F4;
  border-radius: 20rpx;
  position: relative;
}
.sanjiao{
    position: absolute;
    left: 50%;
    top:-15rpx;
    width:0;
    height:0;
    border-left:10px solid transparent;
    border-right:10px solid transparent;
    border-bottom:10px solid #F2F6F4;
    /* z-index: -1; */
}

Summarize

This is the end of this article about how to use pure CSS3+DIV to achieve a small triangular border. For more relevant CSS div content about achieving a triangular border, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Summary of the top ten problems of MySQL index failure

>>:  Div covers the flash. Flash transparent method realizes placing the DIV layer on the flash.

Recommend

The implementation process of Linux process network traffic statistics

Preface Linux has corresponding open source tools...

How to change the MySQL database file directory in Ubuntu

Preface The company's Ubuntu server places th...

Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7

Related reading: MySQL8.0.20 installation tutoria...

js+canvas realizes code rain effect

This article shares the specific code of js+canva...

How to change the character set encoding to UTF8 in MySQL 5.5/5.6 under Linux

1. Log in to MySQL and use SHOW VARIABLES LIKE &#...

MySQL not null constraint case explanation

Table of contents Set a not null constraint when ...

Implementation of IP address configuration in Centos7.5

1. Before configuring the IP address, first use i...

Solution to IDEA not being able to connect to MySQL port number occupation

I can log in to MYSQL normally under the command ...

Docker View JVM Memory Usage

1. Enter the host machine of the docker container...

Detailed explanation of JavaScript timers

Table of contents Brief Introduction setInterval ...

js+css to realize three-level navigation menu

This article example shares the specific code of ...

Several ways to run Python programs in the Linux background

1. The first method is to use the unhup command d...

Details of the underlying data structure of MySQL indexes

Table of contents 1. Index Type 1. B+ Tree 2. Wha...

Example operation MySQL short link

How to set up a MySQL short link 1. Check the mys...