当前位置:网站首页>Background position - mixed units
Background position - mixed units
2022-06-12 08:40:00 【Little boy who likes hot pot】
1. If the two specified values are a mixture of precise units and position nouns , Then the first value is X coordinate , The second value is Y coordinate
Code 1:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Background location —— Precise units </title>
<style>
div{
width: 300px;
height: 300px;
background-color: pink;
background-image: url(images/logo.png);
background-repeat: no-repeat;
/* X It must be 20 Y It must be center Equivalent to background-position: 20px */
background-position: 20px center;
}
</style>
</head>
<body>
<div></div>
</body>
</html> Running effect :
Code 2:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Background location —— Precise units </title>
<style>
div{
width: 300px;
height: 300px;
background-color: pink;
background-image: url(images/logo.png);
background-repeat: no-repeat;
/* Horizontal is centered , The vertical is 20 */
background-position: center 20px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>Running effect :

Code 3: align horizontal center , Vertical distance top 40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Large background image </title>
<style>
body{
background-image: url(images/bg.jpg);
/* The background does not repeat */
background-repeat: no-repeat;
/* Horizontal center , Vertically up */
background-position: center 40px ;
}
</style>
</head>
<body>
</body>
</html>Running effect :

边栏推荐
- Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
- Is it really expensive for enterprises to launch MES software?
- Hands on learning and deep learning -- simple implementation of softmax regression
- When the uniapp page jumps with complex data parameters.
- [advanced pointer I] character array & array pointer & pointer array
- Vision transformer | arXiv 2205 - TRT vit vision transformer for tensorrt
- 进制GB和GiB的区别
- Convert spaces to < br / > newline labels
- Close asymmetric key
- QT realizes multi screen and multi-resolution adaptation
猜你喜欢

Centos8 installing MySQL 8.0 (upper)

MES helps enterprises to transform intelligently and improve the transparency of enterprise production

The difference between deep copy and shallow copy

【进阶指针一】字符数组&数组指针&指针数组

ctfshow web 1-2
![[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array](/img/d2/a6276d8415c46124920395df5651d1.png)
[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array
![[advanced pointer III] implement C language quick sorting function qsort & callback function](/img/f0/3729db83ba3eb15c7df0958858ece9.png)
[advanced pointer III] implement C language quick sorting function qsort & callback function

What is the MES system? What is the operation process of MES system?

Bean的作用域

Loading font component loading effect
随机推荐
Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
Hypergeometric cumulative distribution test overlap
Bean的作用域
【指针进阶三】实现C语言快排函数qsort&回调函数
处理异常数据
What is the MES system? What is the operation process of MES system?
【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C
ctfshow web4
Triggers in MySQL
What kind of sparks will be generated when the remote sensing satellite meets the Beidou navigation satellite?
Install iptables services and open ports
MPLS的原理与配置
call方法和apply方法
QT realizes multi screen and multi-resolution adaptation
JVM学习笔记:垃圾回收机制
(P13) use of final keyword
Specify 404 and 500 error reporting pages.
MES helps enterprises to transform intelligently and improve the transparency of enterprise production
[new planning]
[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array