Question: Im making some div element dynamically

```
var QuickPanelItem = $('<div/>', { 'id': 'div' + WidgetDetails.Name + 'QuickPanel', 'class': 'left_slidethumbs button_' + WidgetDetails.Name + '' });            
QuickPanelItem.append($('<div/>', { 'class': 'text_button' }));
$("#divLeftQuickPanel").append(QuickPanelItem);

```

my doubt is 

```
$('<div/>', { 'class': 'text_button' })

```

we can add attributes of the element by writting them in the flower brackets as in the above line, But how can we add background-image,margin,padding etc which comes under style property.
Also adding inner html.

Answer: 
You can also do something like this:

**js**

```
$("<div/>",{
    id: "a",
    text:"sadsad",
    style:"background-color:red;height:50px;",
    class: "classA"
  }).appendTo("body");

```

[fiddle](http://jsfiddle.net/tZqY4/4/)
Use this **[.css()](http://api.jquery.com/css/)**

```
$('#div' + WidgetDetails.Name + 'QuickPanel').css({
    "background-image":"/path",
    "margin":"20px",
    "padding":"4px"
});

```