Home > Web Front-end > CSS Tutorial > Create a variety of different graphic shapes using only CSS

Create a variety of different graphic shapes using only CSS

巴扎黑
Release: 2017-05-01 14:03:54
Original
1907 people have browsed it

introduce

Today, we are going to learn how to use simple CSS to create different types of flat graphics.

Use code

Rectangle

.rectangle {
    width: 250px;
    height: 150px;
    background-color: #6DC75F;
}

<p></p>
Copy after login

triangle

.triangleUp {
            border-left: 75px solid transparent;
            border-right: 75px solid transparent;
            border-bottom: 150px solid  #6DC75F;
            width: 0;
            height: 0;
        }

<p class="triangleUp"></p>
Copy after login

Oval

.oval {
    width: 300px;
    height: 150px;
    background: #6DC75F;
    -moz-border-radius: 150px / 75px;
    -webkit-border-radius: 150px / 75px;
    border-radius: 150px / 75px;
}

<p class="oval"></p>
Copy after login

Crescent shape

.moon {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  box-shadow: 15px 15px 0 0 green;
}

<p class="moon"></p>
Copy after login

Leaves

.leaf {
    border-radius: 5px 300px 3px 300px;
    background: #6DC75F;
    width: 150px;
    height: 150px;
}

<p class="leaf"></p>
Copy after login

Points of Interest

There are so many amazing things you can do with CSS... Happy coding everyone!

The above is the detailed content of Create a variety of different graphic shapes using only CSS. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template