Use CSS to implement basic bar chart Effects

Source: Internet
Author: User

CSS bar charts are common forms of web design. The number of bar charts can be displayed in the form of a bar chart.
What is the implementation method of CSS basic bar chart? Let's take a look at the following example: CopyCode The Code is as follows: <Div class = "Graph">
<Strong class = "bar" style = "width: 24%;"> 24% </strong>
</Div>

This is the XHTML code. It defines a container and the application class graph, which includes an XHTML element strong and applies the class bar to this element.
Let's look at the following CSS definition:Copy codeThe Code is as follows:. Graph {
Position: relative;/* IE is dumb */
Width: 200px;
Border: 1px solid # b1d632;
Padding: 2px;
}
. Graph. Bar {
Display: block;
Position: relative;
Background: # b1d632;
Text-align: center;
Color: #333;
Height: 2em;
Line-Height: 2em;
}
. Graph. Bar span {position: absolute; left: 1em ;}

Through the border and color definition above, we outline a bar chart. In the XHTML code, style = "width: 24% ;", defines the size of the configured area. This basic bar chart is complete!
We can see the final running effect:Xmlns = "http://www.w3.org/1999/xhtml">


24% 60%

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.