Reputation: 6504
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
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
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
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