Error with computed size of relative-size HTML elements in javascript -


my window object has width of 1361px.

a container div has width set 90%, theorically makes 1224.9px.

however, computed size of ( $("#mycontainer").width() ) returns 1225px. fyi, computed number seems come browser itself, not jquery.

now, problem if put 2 floating divs in it, respectively 1000px , 225px, not fit on same line, allegedly because 1225px > 1224.9px. @ least in ff , chrome, not tested elsewhere.

if set container fixed size of 1225px, 2 divs on same line, confirms in mind browser not use superior-rounded computed size know how space available children occupy.

i wanted know if knew how solve this. not sure how percentage size of container maths myself :

var width = math.floor($(window).width * $("#mycontainer").percentagewidth() / 100) 

thank you.

css display: flex; way fix these quirks nowadays.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -