Используйте подрывную деятельность, это легко установить, простой в использовании, и имеет много инструментов. Любая будущая система пересмотра будет иметь импорт от функции SVN, таким образом, это не будет похоже на Вас, не может измениться в будущем, если Ваши потребности растут.
Yes you need an encapsulating div:
<div id="logo"><img src="logo.jpg"></div>
with something like:
#logo { height: 100px; width: 200px; overflow: hidden; }
Other solutions (padding, margin) are more tedious (in that you need to calculate the right value based on the image's dimensions) but also don't effectively allow the container to be smaller than the image.
Also, the above can be adapted much more easily for different layouts. For example, if you want the image at the bottom right:
#logo { position: relative; height: 100px; width: 200px; }
#logo img { position: absolute; right: 0; bottom: 0; }
Do I have to add an encapsulating
or ?I think you do. The only thing that comes to mind is padding, but for that you would have to know the image's dimensions beforehand.
1ответ дан 24 November 2019 в 13:38поделиться
you can try setting the padding instead of the height/width.
What I can think of is to stretch either width or height and let it resize in ratio-aspect. There will be some white space on the sides. Something like how a Wide screen displays a resolution of 1024x768.