Home > Web Front-end > HTML Tutorial > css 如何让浮动DIV水平居中

css 如何让浮动DIV水平居中

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 09:53:25
Original
1726 people have browsed it

实例如下:

<code class="language-html">

<meta charset="UTF-8">
<title>css3对话框设计</title>
<style>
.box{
    float:left;
    position:relative;
    left:50%;
}
p{
    float:left;
    position:relative;
    right:50%;
}
</style>


<div class="box">
    <p>我是浮动的</p>
    <p>我也是居中的</p>
</div>

</code>
Copy after login

 

Related labels:
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
Latest Issues
Float a div inside another div
From 1970-01-01 08:00:00
0
0
0
javascript - div carousel issue
From 1970-01-01 08:00:00
0
0
0
Div captures mouse scroll
From 1970-01-01 08:00:00
0
0
0
How to make a div appear below another div in CSS
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template