JSP如何设置居中
<%@pagelanguage="java"import="java.util.*"pageEncoding="GB2312"%><%Stringpath=request...
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
.bodypage
{
margin-left:auto;
margin-right: auto;
}
.div1{
float:left;/*左置*/
width:200px;/*宽*/
height:100px;/*高*/
border:2px solid #000000;/*边框粗细 实心线 边框颜色*/
margin-top:20px;/*其顶部与包含此元素容器的距离为20像素*/
}
.div2{
float:left;/*右置*/
width:200px;
height:100px;
border:2px solid #000000;
margin-top:20px;
}
</style>
</head>
<body>
<div class="bodypage">
<div class="div1">
</div>
<div class="div2">
</div>
</div>
</body>
</html>
为什么加了margin :auto 还是没有居中 ? 怎样居中? 展开
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
.bodypage
{
margin-left:auto;
margin-right: auto;
}
.div1{
float:left;/*左置*/
width:200px;/*宽*/
height:100px;/*高*/
border:2px solid #000000;/*边框粗细 实心线 边框颜色*/
margin-top:20px;/*其顶部与包含此元素容器的距离为20像素*/
}
.div2{
float:left;/*右置*/
width:200px;
height:100px;
border:2px solid #000000;
margin-top:20px;
}
</style>
</head>
<body>
<div class="bodypage">
<div class="div1">
</div>
<div class="div2">
</div>
</div>
</body>
</html>
为什么加了margin :auto 还是没有居中 ? 怎样居中? 展开
6个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询