what's the best way to force DIV
to fill specified width?
I have the following code that generates and assign width to DIV
:
function createLabel(str) {
var textDiv = document.createElement('div');
textDiv.style.width = '200px';
textDiv.style.display = 'inline';
textDiv.appendChild(document.createTextNode(str));
return textDiv;
}
I want created DIV's to have the same width, whatever text length is.