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

Detailed explanation of the setting of background-image attribute in HTML

When it comes to pictures, the first thing we thi...

VMware Workstation installation Linux system

From getting started to becoming a novice, the Li...

How to define input type=file style

Why beautify the file control? Just imagine that a...

Simple operation of installing vi command in docker container

When using a docker container, sometimes vim is n...

Examples of vertical grid and progressive line spacing

New Questions Come and go in a hurry. It has been...

HTML head tag meta to achieve refresh redirection

Copy code The code is as follows: <html> &l...

JavaScript String Object Methods

Table of contents Methods of String Object Method...

A brief discussion on MySql views, triggers and stored procedures

view What is a view? What is the role of a view? ...

Detailed explanation of common commands in MySQL 8.0+

Enable remote access Enable remote access rights ...

How to add Nginx to system services in CentOS7

Introduction After compiling, installing and solv...

How to use jsx syntax correctly in vue

Table of contents Preface Virtual DOM What is Vir...

jQuery implements accordion effects

This article shares the specific code of jQuery t...