Home > Web Front-end > HTML Tutorial > How should I set the position of the div? _html/css_WEB-ITnose

How should I set the position of the div? _html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 12:18:57
Original
2185 people have browsed it

I fixed several tables in a div, and then prepared to place the div in the middle of the web page.
How should I set the position of the div?


Reply to discussion (solution)

If the width of this div is set Use padding-left to set the body with a percentage and center the div to the horizontal position of the page. Try
. Try using padding-top

is in the middle of the screen. Why

has no effect?

LZ search online about horizontal centering and vertical centering. There are many online.

align is to set the horizontal position of the content inside the div. If the width of the div is set, the horizontal position of the content is only in the middle of the div instead of the middle of the page.
valign The vertical position of the div seems not to be centered. Place the div in a Try setting the vertical centering of the td in a td with 100% height and width

margin:0 auto

position margin pading...

Do you mean you want to Centered? If so, just set the marginleft and marginright properties of the div to auto.

Agree with Floor 6, just give the DIV a width and let it adapt left and right.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template