CSS 中的 object-position 属性
cssweb developmentfront end technology更新于 2024/11/4 1:48:17
object-position 属性用于指定图像或视频在其自身框内的位置。
示例
<!DOCTYPE html>
<html>
<head>
<style>
img.demo {
width: 200px;
height: 200px;
object-fit: none;
object-position: 10px 20%;
border: 2px dashed yellow;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<img class="demo" src="https://www.cainiaomax.com/memcached/images/memcached-mini-logo.jpg" alt="Memcached" width="400" height="250">
<h2>Memcached Tutorial</h2>
<img src="https://www.cainiaomax.com/memcached/images/memcached-mini-logo.jpg" alt="Memcached" width="300" height="250">
</body>
</html>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

