is it possible to automatically resize div and its content when browser window is resized? i want text not to wrap. i want to adjust image and font size to have the same composition (or layout). is it possible to do it using CSS? thanks Martin
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
I have wanted to change image size relatively to ratio of parent div and window size. I have used code posted below. The problem is, the image width is resize correctly but height is devided by 13 instead of 3.9 in my case. can you see the error? thanks
CSS provides only limited (semi-)events, however, you may be able to use the width or orientation media queries to apply different styles based on the width of the window.
Thus, for some browsers, you can use:
Which will paint all the text red when the window width is less than its height.
More accurately, you can use width:
Which will paint the text red when the window is less than 800px wide. Try resizing this page to see the effect.
To be more precise requires javascript.
I think the following solution is very useful for resizing objects constantly - this is just one example:
CSS:
HTML:
FIDDLE: https://jsfiddle.net/uxj77rg1/
You can use the jquery's resize method. and u can put something like this...
so u can add change font size or any image height or anything... and if u don't want to use jquery then u can check out the link below, WINDOW SIZE
but from my point of view u should use Jquery......