0
点赞
收藏
分享

微信扫一扫

背景图片的位置(HTML、CSS)

GG_lyf 2022-10-20 阅读 151


背景图片的位置(HTML、CSS)

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>背景图片的位置</title>
<style>
div {
width: 800px;
height: 400px;
background-image: url(imges/qbxjs.png);
/* background-repeat: repeat-x; */
background-color: gray;
/* background-position: 0 0; 方位名词 */
/* background-position: center top; */
/* background-position: 20px 50px; */
/* background-position: 20px; */
/* x=20px的时候 y不写 y是默认居中的 */
/* 分别表示x轴 y轴 */

/* x一定是20px y一定是center 等价于 background-position: 20px;*/

/* ackground-position: 20px center; */
/* 此种写法叫做混合参数 */

background-position: center 100px;
/* 水平居中 垂直是20px */
background-repeat: no-repeat;
}


举报

相关推荐

0 条评论