Sample code for displaying reminder dots in the upper left or upper right corner using CSS3

Sample code for displaying reminder dots in the upper left or upper right corner using CSS3

Effect picture (if you want a triangle, please click here):

Code:

<html>
<head>
    <style type="text/css">
        .message_s {
            position: relative;
            cursor: pointer;
        }
 
            .message_s:after {
                position: absolute;
                content: "";
                /*The following content can be adjusted according to actual needs-----start------*/
                top: 0px;
                left: -13px; /*Change to: right: -13px; The dot is displayed on the right*/
                width: 8px;
                height: 8px;
                border-radius: 50%;
                background-color: #e98b7f;
                /*-----end------*/
            }
 
        div {
            height: 30px;
            border: 1px #000 solid;
            width: 300px;
            line-height: 30px;
            padding: 0px 0px 0px 15px;
        }
    </style>
    <script>
        function clickAction()
        {
            console.log("If Heaven had not given me a leader, the road of keys would have been long as night!");
        }
    </script>
</head>
<body>
    <div>
        <span class="message_s" onclick="clickAction()"></span>
        Sword Opens the Gate of Heaven
</body>
</html>

Appendix: Let’s look at the red triangle icon in the upper left corner.

The red triangle mark is implemented in the upper left corner, as shown in the figure

It is implemented using pseudo-classes, focusing on position, transform, and border attributes.

To adjust the position, just modify the values ​​of top and left.

<html>
<head>
<title> New Document </title>
<style>
    div {
        background-color: #f4f4f4;
        padding: 20px;
    }
 
    .message_s {
        position: relative;
    }
 
        .message_s:after {
            position: absolute;
            top: -25px;
            display: block;
            width: 0;
            height: 0;
            border: 16px solid transparent;
            content: "";
            -webkit-transform: rotate(45deg);
        }
 
        .message_s:after {
            left: -25px;
            z-index: 0;
            border-right-color: red;
        }
</style>
</head>
<body>
<div>
    <span class="message_s">Internet Explorer 10, Firefox, and Opera support the transform attribute. Internet Explorer 9 supports the alternative -ms-transform property (for 2D transforms only). Safari and Chrome support the alternative -webkit-transform property (3D and 2D transforms). Opera only supports 2D transitions. </span>
</div>
</body>
</html>

This concludes this article about how to use CSS3 to display reminder dots in the upper left or upper right corner. For more relevant CSS3 reminder dots content, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Detailed explanation of JavaScript program loop structure

>>:  Detailed explanation of docker visualization graphics tool portainer

Recommend

MySQL database Load Data multiple uses

Table of contents Multiple uses of MySQL Load Dat...

Some ways to eliminate duplicate rows in MySQL

SQL statement /* Some methods of eliminating dupl...

Pessimistic locking and optimistic locking in MySQL

In relational databases, pessimistic locking and ...

js to call the network camera and handle common errors

Recently, due to business reasons, I need to acce...

Determine whether MySQL update will lock the table through examples

Two cases: 1. With index 2. Without index Prerequ...

Docker uses busybox to create a base image

The first line of a Docker image starts with an i...

Implementing a simple age calculator based on HTML+JS

Table of contents Preface Demonstration effect HT...

Vue.js application performance optimization analysis + solution

Table of contents 1. Introduction 2. Why do we ne...

Experience in designing a layered interface in web design

Many netizens often ask why their websites always ...

How to make React components full screen

introduce This article is based on React + antd t...

Docker container accesses the host's MySQL operation

background: There is a flask project that provide...

mysql8.0 windows x64 zip package installation and configuration tutorial

MySQL 8 Windows version zip installation steps (d...

Vue.js manages the encapsulation of background table components

Table of contents Problem Analysis Why encapsulat...

Native js to achieve puzzle effect

This article shares the specific code of native j...