Home >Web Front-end >HTML Tutorial >How to center a 1900px image on a web page_html/css_WEB-ITnose
Let me ask you a question. I want to widen the image to 1900px at the top of the web page. How can I center it? Does anyone have any js code or widget that can close the top image like JD.com? If you have any, you can send me an email at 923530881@qq.com. Thank you everyone
The img attribute margin:0 auto in the div; the image is centered, JS does not require a plug-in, just a few words That’s it. If you don’t know how to write, you can search on Baidu
If it is a background image, you can do it like this
.box{
background:url(image address) center top no-repeat;
}
If you place img directly, you can use text-align:center
The width of the picture is too large Right, margin-left: auto, margin-right: auto
The picture can be centered
The width of the picture is too large, margin-left: auto, margin-right: auto
The picture can be centered
The img attribute margin: 0 auto in the div; the image is centered, and JS does not require a plug-in, just a few sentences is enough. If you don’t know how to write, you can search it on Baidu
If it is a background image, it can be like this
.box{
background:url(image address) center top no-repeat;
}
If you place img directly, you can use text-align:center