Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何动态设置此图像的边框。(图片总是在变化,所以不要为我提供固定的 px 大小)高度可以 100%,但是当我尝试对“宽度”使用相同的解决方案时,它不起作用。我尝试一切,例如;!重要,100%,自动等。在此先感谢。
只需在图像上指定一个标准的 CSS 边框 - 它会自动调整为图像的高度和宽度。例子:
img { border: 5px solid black; border-radius: 10px; padding: 2px; }
或查看http://jsfiddle.net/F45T8/。