If, for whatever reason, you sometimes feel like creating a rectangle using html/css, the below code is the easiest way to do so. A given rectangle can also be decorated using tags like background-color.

Here’s the code:

<div style="width:500px;height:100px;border:1px solid #000;">This is a rectangle!</div>

And here’s the result:

This is a rectangle!

There you go: no fuss, no muss.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.


No Reader comments

Learn JavaScript for free!
Free course: Introduction to JavaScript

Yours when you take up a free 14-day SitePoint Premium trial.