Html “中间的CSS按钮”;中心“; 我试着把我的按钮放在中间,但是我不知道该怎么做,因为我不是CSS中最好的。p>
我不知道我在代码中是否做对了,但我已经试着把它放在中间 我该怎么做才能把我的按钮放在屏幕中间呢?Html “中间的CSS按钮”;中心“; 我试着把我的按钮放在中间,但是我不知道该怎么做,因为我不是CSS中最好的。p>,html,css,Html,Css,我不知道我在代码中是否做对了,但我已经试着把它放在中间 我该怎么做才能把我的按钮放在屏幕中间呢? <style> body { background-image: url(http://1-background.com/images/silk/grey-silk-website-background.jpg); } .button { display:block; text-align:center; }
<style>
body {
background-image: url(http://1-background.com/images/silk/grey-silk-website-background.jpg);
}
.button {
display:block;
text-align:center;
}
h1{
text-align: center;
}
.remove{
color: red;
align-items: center;
}
.create{
color: green;
align-items: center;
}
.test{
color: blue;
align-items: center;
}
</style>
<body>
<form>
<h1>
<select id="mySelect" style="width:400px" size="10" multiple>
<option id=" hello">hello</option>
</select>
<br />
<input type="text" name="name" value="text " style="width:350px" />
</h1>
</form>
<br>
<la class=" remove"><button onclick="myRemove()" style=" align-items: center; width: 225px"><h2 class="remove"><img id="hi" src="http://outlooksettings.com/wp-content/uploads/2014/12/remove-md.png" width="40"> Remove</h2></button>
</la>
<la class="create"><button type="button" onclick="myCreate()" style=" align-items: center; width: 225px"><h2 class="create"><img id="hi" src="https://cdn0.iconfinder.com/data/icons/large-glossy-icons/512/Create.png" width="40">Create</h2></button>
</la>
<la class="test"><button type="button" onclick="test()" style=" align-items: center; width: 225px"><h2 style="width:80px" class="test"><img id="hi" src="https://lh4.ggpht.com/lUcLbewm2mffnhc1_BbZYi5zjEXAzfeYf73cg2SXjFDX3_xNnHGUMkSRdh86TN8HqcSq7Qr3vA=w512" width="40">File</h2></button>
</la>
身体{
背景图片:url(http://1-background.com/images/silk/grey-silk-website-background.jpg);
}
.按钮{
显示:块;
文本对齐:居中;
}
h1{
文本对齐:居中;
}
.移除{
颜色:红色;
对齐项目:居中;
}
.创造{
颜色:绿色;
对齐项目:居中;
}
.测试{
颜色:蓝色;
对齐项目:居中;
}
你好
去除
创造
文件
我会将它们放在一个div中,并将以下CSS应用于该div:
.my-div {
width: 100%;
text-align: center;
}
要了解更多信息,请查看
您案例中的结果:
SVG行
身体{
背景图片:url(http://1-background.com/images/silk/grey-silk-
网站背景.jpg);
}
.按钮{
显示:块;
文本对齐:居中;
}
h1{
文本对齐:居中;
}
.移除{
颜色:红色;
对齐项目:居中;
}
.创造{
颜色:绿色;
对齐项目:居中;
}
.测试{
颜色:蓝色;
对齐项目:居中;
}
.我的部门{
宽度:100%;
文本对齐:居中;
}
你好
去除
创造
文件
以设定的宽度将按钮包装在一个div中,并应用边距:0 auto
。按钮包装器{
宽度:685px;
保证金:0自动;
}
.按钮包装器>div{
显示:内联块;
}
.按钮{
显示:块;
文本对齐:居中;
}
h1{
文本对齐:居中;
}
.移除{
颜色:红色;
对齐项目:居中;
}
.创造{
颜色:绿色;
对齐项目:居中;
}
.测试{
颜色:蓝色;
对齐项目:居中;
}
你好
去除
创造
文件
什么是
标签?@Aaron我想Mikkel的意思是使用
(或者不太可能是
)。如果是Mikkel,请检查。这是一个错误,我知道有一个