Search code examples
javascriptgridsterdashing

How to create a dashing like widget object in javascript


I am trying to create a widget/tile object to display on my page. Basically its a rectangular box with a background color which I would like to display some text in.

To be specific I want to create widgets like the ones in dashing (dashing.io).

I am kinda new to JS/HTML.


Solution

  • HTML:

    <div class=widget>
    <h2>Some text</h2>
    </div>
    

    CSS: You can change the values

    .widget {
    width: 100px;
    height: 100px;
    background-color: red;
    }
    h2 {
     margin: auto;
    }