Baqer Naqvi
Baqer Naqvi

Reputation: 6504

How to increase width of label?

I am adding a div dynamically.It contains random amount of data that sometimes spreads over more than one lines. Problem is that it becomes conj-gusted in that case.

Sample enter image description here

in other words, i want to increase the line spacing of that label. Here is code i am adding label

var m=0;
var ttp = document.getElementById("T_" + (m + 1));
var LH = document.createElement('label');
LH.id = "H_" + element_name + "_" + (m + 1);
var pp = document.createElement('p');
pp.innerHTML = "<br>" + element_name;
LH.appendChild(pp);
ttp.appendChild(LH);

Upvotes: 0

Views: 120

Answers (2)

Moorthy GK
Moorthy GK

Reputation: 1301

You can able to add styles for a particular element at the time of creating. you can assign your styles here: obj.style.cssText

var LH = document.createElement('label');

//Code for set line height
LH.style.lineHeight = "15px";
LH.id = "H_" + element_name + "_" + (m + 1);

Upvotes: 1

Faiqa
Faiqa

Reputation: 155

Through Javascript u can change the css by this

document.getElementById("lableId").style.line-height="20%";

or u can set css via

$('#LabelID').css('attribute','value');

Upvotes: 0

Related Questions