0

i have a below code. i need to position the div elements.

<div id="outer" style="width:300px">
<canvas></canvas>
<div id="inner">
<div class="a"> val1 </div>
<div class="a"> val2 </div>
<div class="a"> val3 </div>
<div class="a">val4</div>
</div>
</div>
.a{
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap'
}

I need to position the innerdiv around the canvas element. suppose if i give the position bottom the comes under the canvas element and should be horizontally center aligned. if i give the position right the inner div should be right of the canvas and it should be vertically center aligned.i am giving the attribute position to the script. i tried a lot in JavaScript through CSS. Suppose if no space in the outer div the inner div text need to shrink with ...(dots)..please help me..

Srinivasan
  • 69
  • 1
  • 1
  • 6

2 Answers2

0

You can set css property somthing like this

document.getElementById("id").style.porpertyName = "value" ; 
Sudesh
  • 100
  • 4
  • thing i need is what are the css needed for the "outer" div,canvas element and "inner" div to get my requirement.. – Srinivasan Nov 25 '14 at 12:12
0
var div = document.createElement("div");
div.style.width = "100px";
div.style.height = "100px";
div.style.background = "red";
div.style.color = "white";
div.innerHTML = "Hello";

document.body.appendChild(div);

Refer This

Community
  • 1
  • 1
Amol
  • 1,431
  • 2
  • 18
  • 32
  • yes i know how to add css properties. i just want what are all the css properties required to get my requirement... – Srinivasan Nov 25 '14 at 12:20