我有一个按钮div,里面有一个img和按钮。我试图将div放在div内部的按钮上,以我的FacebookDivv为中心。
<div id="FacebookDivv">
<div id="buttonDiv">
<button id="loginBut" ><p id="SignInText">Sign In</p></button>
<img src="http://icons.iconarchive.com/icons/alecive/flatwoken/512/Apps-Facebook-icon.png" height="150px" width="150px" margin-top="50vh">
</div>
</div>
我的css是:
#loginBut {
border-color: #2d5073;
background-color: #3b5998;
height: 40px;
display: inline-block;
width: 120px;
background-image: url(http://icons.iconarchive.com/icons/danleech/simple/512/facebook-icon.png);
background: url(http://aroosamanzar.com/uploads/images/facebook-logo-png-white-i6.png), -webkit-gradient(linear, left top, left bottom, color-stop(0%, #4c74c4), color-stop(100%, #3b5998));
background-size: 25px 25px, cover;
background-position: 170px center, center center;
background-repeat: no-repeat, repeat;
}
#buttonDiv{
width: 150px;
align-content: center;
display: inline-block;
margin-top: 40vh;
}
当我加载页面时,按钮是img和img并且检查src说它甚至不在buttonDiv中?
答案 0 :(得分:1)
删除HTML中p
标记内的button
标记,如果您希望图片为该按钮设置内容,请将其用作背景图片,而不是img
标记