css圆角三角形3个圆角_CSS中的圆角

墨蓝 2023-03-05 09:57 159阅读 0赞

css圆角三角形3个圆角

CSS | 圆角 (CSS | Rounded Corners)

border-radius property is commonly used to convert box elements into circles. We can convert box elements into the circle element by setting the border-radius to half of the length of a square element.

border-radius属性通常用于将框元素转换为圆形。 通过将边框半径设置为正方形元素长度的一半,我们可以将框元素转换为圆形元素。

Basic syntax:

基本语法:

  1. Element {
  2. width: 150px;
  3. height: 150px;
  4. border-radius: 50%;
  5. }

Example:

例:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6. background: #73AD21;
  7. width: 200px;
  8. height: 150px;
  9. border-radius: 50%
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>CSS Rounded Corners</h1>
  15. <p></p>
  16. </body>
  17. </html>

Output

输出量

Rounded Corners in CSS | Example 1

In the above example, 50% border-radius is applied to all the corners.

在上面的示例中,将50%的边界半径应用于所有角。

圆角属性 (Rounded Corner properties)

  • border-radius

    边界半径

  • border-top-left-radius

    边界左上角半径

  • border-top-right-radius

    边界右上半径

  • border-bottom-left-radius

    左下半径半径

  • border-bottom-right-radius

    右下边界半径

1)边界半径 (1) border-radius)

This CSS property specifies the radius of the corners of the element. border-radius property can have values between one to four.

此CSS属性指定元素的角的半径。 border-radius属性的值可以在1-4之间。

1) One value

1)一个值

The property takes a single value to the border-radius and that value is applied to all the four corners and the corners are rounded equally.

该属性对边界半径采用单个值,并且该值应用于所有四个角,并且这些角均等地舍入。

Syntax:

句法:

  1. Element {
  2. border-radius: 15px;
  3. }

2) Two values

2)两个值

This property takes two values to the border-radius. The first value is applied to top-left and bottom-right corners, the second value is applied to top-right and bottom-left corners.

此属性将两个值用作边框半径。 第一个值应用于左上角和右下角,第二个值应用于右上角和左下角。

Syntax:

句法:

  1. Element {
  2. border-radius: 15px 10px;
  3. }

3) Three values

3)三个值

This property takes three values to the border-radius.The first value is applied to the top-left corner and the second value is applied to top-right and bottom-left corners, and the third value is applied to the bottom-right corner.

此属性将三个值用于边框半径。第一个值应用于左上角,第二个值应用于右上角和左下角,第三个值应用于右下角。

Syntax:

句法:

  1. Element {
  2. border-radius: 15px 10px 30px;
  3. }

4) Four values

4)四个值

This property takes four values to the border-radius and applies four different values to each of the corners.The first value is applied to the top-left corner, the second value is applied to the top-right corner, the third value is applied to the bottom-right corner and the fourth value is applied to the bottom-left corner.

此属性将四个值应用于边界半径,并将四个不同的值应用于每个角。第一个值应用于左上角,第二个值应用于右上角,第三个值被应用设置为右下角,第四个值应用于左下角。

Syntax:

句法:

  1. Element {
  2. border-radius: 15px 10px 20px 5px;
  3. }

边界左上角半径 (border-top-left-radius)

This property specifies the radius of the top left corner. This property takes value in length and in % where % defines the shape of the top-left corner in %.

此属性指定左上角的半径。 此属性的长度和%取值其中%定义以%表示的左上角的形状。

Syntax:

句法:

  1. Element {
  2. border-top-left-radius: 50%
  3. }

Example:

例:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6. background: #a44170;
  7. width: 200px;
  8. height: 150px;
  9. border-top-left-radius: 15px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>CSS Rounded Corners</h1>
  15. <p></p>
  16. </body>
  17. </html>

Output

输出量

Rounded Corners in CSS | Example 2

In the above example, the top-left corner is rounded.

在上面的示例中, 左上角是圆形的。

边界右上半径 (border-top-right-radius)

This property specifies the radius of the top right corner. This property takes values in length and in % where % defines the shape of the top-right corner in %.

此属性指定右上角的半径。 此属性的长度和%,其中%定义以%计的右上角的形状花费值。

Syntax:

句法:

  1. Element {
  2. border-top-right-radius: 50%;
  3. }

Example:

例:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6. background: #a44170;
  7. width: 200px;
  8. height: 150px;
  9. border-top-right-radius: 15px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>CSS Rounded Corners</h1>
  15. <p></p>
  16. </body>
  17. </html>

Output

输出量

Rounded Corners in CSS | Example 3

In the above example, the top right corner is rounded.

在上面的示例中,右上角是圆形的。

左下半径半径 (border-bottom-left-radius)

This property specifies the radius of the bottom left corner. This property takes values in length and in % where % defines the shape of the bottom-left corner in %.

此属性指定左下角的半径。 此属性的长度和%,其中%定义以%表示的左下角的形状花费值。

Syntax:

句法:

  1. Element {
  2. border-bottom-left-radius: 50%;
  3. }

Example:

例:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6. background: #a44170;
  7. width: 200px;
  8. height: 150px;
  9. border-bottom-left-radius: 15px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>CSS Rounded Corners</h1>
  15. <p></p>
  16. </body>
  17. </html>

Output

输出量

Rounded Corners in CSS | Example 4

In the above example, the bottom left corner is rounded.

在上面的示例中,左下角是圆形的。

右下边界半径 (border-bottom-right-radius)

This property specifies the radius of the bottom right corner. This property takes values in length and in % where % defines the shape of the bottom-right corner in %.

此属性指定右下角的半径。 此属性的长度和%,其中%定义以%表示的右下角的形状花费值。

Syntax:

句法:

  1. Element {
  2. border-bottom-right-radius: 50%;
  3. }

Example:

例:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6. background: #a44170;
  7. width: 200px;
  8. height: 150px;
  9. border-bottom-right-radius: 15px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>CSS Rounded Corners</h1>
  15. <p></p>
  16. </body>
  17. </html>

Output

输出量

Rounded Corners in CSS | Example 5

In the above example, the bottom right corner is rounded.

在上面的示例中,右下角是圆形的。

翻译自: https://www.includehelp.com/code-snippets/rounded-corners-in-css.aspx

css圆角三角形3个圆角

发表评论

表情:
评论列表 (有 0 条评论,159人围观)

还没有评论,来说两句吧...

相关阅读

    相关 CSS圆角效果

    上一篇博文中提到了css2.0的圆角效果,但是没有实现,今天闲着没事儿做了一个,想想还是css3来的痛快,用css2做一个圆角确实还是挺痛苦的,其他不说了,先截个图    

    相关 CSS3圆角

    ![在这里插入图片描述][2019030514481083.png] 浏览器支持 表格中的数字表示支持该属性的第一个浏览器的版本号。 \-webkit- 或 -mo