Home Web Front-end CSS Tutorial Create a simple static progress bar with html and CSS (detailed explanation with pictures and text)

Create a simple static progress bar with html and CSS (detailed explanation with pictures and text)

Oct 29, 2018 pm 02:12 PM
css html progress bar

Friends who often browse websites or frequently layout pages should be familiar with progress bars, and some progress bars will have animation effects when the page is refreshed. Friends who are learning front-end knowledge, you will use html and CSS Make a simple static progress bar? This article will tell you how to use HTML and CSS to achieve the progress bar effect, and finally share the simple HTML progress bar code. Interested friends can refer to it.

Using CSS to make a simple progress bar requires the use of basic knowledge in CSS, such as border-radius rounded corners, centering, etc. If you are unclear, you can refer to the relevant articles on the PHP Chinese website, or Visit CSS video tutorial and be sure to learn the basics well!

Example: Use html and CSS to make a simple static progress bar

HTML part:

Observing the progress bar, you can find that the progress bar consists of two parts, one is progress The total length of the bar, one is the length of the progress, so we create two divs, one div as the parent element and the other div as the child element, and give them a class name respectively to facilitate setting styles. The specific code is as follows:

<p>进度条</p>
<div class="container">
   <div class="skills loading">70%</div>
</div>
Copy after login

CSS part:

The basic framework has come out, now we need to style the two divs. Set the length of the first div to 300px, the height to 30px, and the background color to #ddd. For aesthetics, we can also use the border-radius attribute to make it rounded. Set the length of the second div to 70%, which is the value of the progress bar. Give the div a color different from the parent element to make it easier to see the effect. Finally, use line-height and text-align: center to center the position horizontally and vertically. , the specific code is as follows:

.container {
    width: 300px;
    height: 30px;
    background-color: #ddd;
    border-radius: 20px;
   }
   
   .skills {
    line-height: 30px;
    color: white;
    border-radius: 20px;
    text-align: center;
    width: 70%;
    background-color: #4CAF50;
   }
Copy after login

Effect picture:

Create a simple static progress bar with html and CSS (detailed explanation with pictures and text)

As can be seen from the picture, a 70% green progress bar has been created.

The above introduces you how to use html and CSS to make a simple static progress bar. The steps are explained in detail, which is relatively simple and easy to understand. Friends who are new to css must try it and practice it yourself to see if you can Can the code show the effect of the progress bar? I hope this article can help you!

More related tutorial recommendations

1, CSS online manual

2,HTML video tutorial

3, Bootstrap video tutorial

The above is the detailed content of Create a simple static progress bar with html and CSS (detailed explanation with pictures and text). For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles