我试图将这些按钮放在中心,但大多数在线的东西都不起作用.<center>不起作用,text-align:center不起作用.
按钮应以完全相同的方式显示,除了居中于中间.如果您尝试这样做,它将无法正常工作.我猜,一定有问题.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>website</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
});
</script>
<style type="text/css">
.button0 {
position:fixed;
left:88px;
top:58px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
}
.button1 {
position:fixed;
left:6px;
top:191px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
text-align: center;
margin-left:auto;
margin-right:auto;
}
.button2 {
position:fixed;
left:358px;
top:216px;
font-family:MS Shell Dlg 2;
font-size:8px;
font-weight:NORMAL;
}
</style>
<body>
<center>
<div class="button0"><input type="button" style="width: 268px;height: 145px;" value="Button"/></div>
<div class="button1"><input type="button" style="width: 40px;height: 88px;" value="Button"/></div>
<div class="button2"><input type="button" style="width: 76px;height: 73px;" value="Button"/></div>
</center>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
.container {
text-align: center;
}
.center-element {
width: 100px;
text-align: left;
}
Run Code Online (Sandbox Code Playgroud)
要么
.container {
width: 200px;
}
.center-element {
width: 100px;
margin: 0px auto 0px auto;
}
Run Code Online (Sandbox Code Playgroud)
要么
.container {
width: 200px;
}
.center-element {
width: 100px;
position: relative;
left: 50%;
margin-left: -50px;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20912 次 |
| 最近记录: |