Detailed explanation of several ways to create a top-left triangle in CSS

Detailed explanation of several ways to create a top-left triangle in CSS

Today we will introduce several ways to use CSS to write a top-left triangle.

Schematic diagram (taking 60px width and height as an example):

This kind of triangle can generally be used as the lower left foot of "dialog box" type graphics.

The first one:

#triangle-topleft {
  border: 30px solid #e6686e;
  height: 0;
  width: 0;
  border-right-color: transparent;
  border-bottom-color: transparent;
}

Second type:

#triangle-topleft {
  width: 0;
  height: 0;
  border-top: 60px solid #e6686e;
  border-right: 60px solid transparent;
}

The third type:

#triangle-topleft {
  border: 60px solid transparent;
  width: 0;
  height: 0;
  border-left-color: #e6686e;
  border-top-width: 0;
}

You can try more different triangle methods and triangles in different directions.

Here is a highly recommended website that showcases commonly used CSS graphics: https://css-tricks.com/the-shapes-of-css/

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  Optimizing query speed of MySQL with tens of millions of data using indexes

>>:  Web page layout should consider IE6 compatibility issues

Recommend

Master-slave synchronous replication configuration of MySQL database under Linux

The advantage of the master-slave synchronization...

Display ellipsis effect when table cell content exceeds (implementation code)

illustrate In front-end development, you often en...

Detailed Tutorial on Using xargs Command on Linux

Hello everyone, I am Liang Xu. When using Linux, ...

A solution to a bug in IE6 with jquery-multiselect

When using jquery-multiselect (a control that tra...

How to use Greek letters in HTML pages

Greek letters are a very commonly used series of ...

Add a startup method to Linux (service/script)

Configuration file that needs to be loaded when t...

Use SQL statement to determine whether the record already exists before insert

Table of contents Determine whether a record alre...

How to run Python script on Docker

First create a specific project directory for you...

js to achieve drag and drop sorting details

Table of contents 1. Introduction 2. Implementati...

Summarize how to optimize Nginx performance under high concurrency

Table of contents Features Advantages Installatio...

Disable input text box input implementation properties

Today I want to summarize several very useful HTML...

Tutorial on installing Apache 2.4.41 on Windows 10

1. Apache 2.4.41 installation and configuration T...

HTML imitates Baidu Encyclopedia navigation drop-down menu function

HTML imitates the Baidu Encyclopedia navigation d...

WeChat applet uniapp realizes the left swipe to delete effect (complete code)

WeChat applet uniapp realizes the left swipe to d...

How to install MySQL 5.7 from source code in CentOS 7 environment

This article describes how to install MySQL 5.7 f...