Problem wit Resizing HTML div elements acording to screen resolution
i am trying to resize the screen elements mainly div tags, left,top,width,height by giving all the val开发者_JAVA技巧ues in %age. It seems to work but with one problem.
i compute width from actual (px/screen width)*100 and height by (px/screen height)*100 now since both heigh and width are constraint against screen widht and height, if the aspect ratio remains same with any resolution it works.
But problem comes when say the width remains the same and height changes, like by decreasing height, it changes the height and elements width remains the same. This make them look bad and compressed on the screen. Is there anyway i can keep the constraint intact like with videos we have?
Or is it i should also compute the height against screen widht or vice versa??
I don't know what videos you speak of, but it's generally best practice to write screen size-independent web UI. You need to account for the lowest common denominator that you want to support, and in theory it should work for all higher.
精彩评论