我想将中心设置为.user-menu
位置,但我下面的代码不起作用。我该如何解决这个问题?
HTML
<body>
<div class="user-menu">
<div class="menu-items">
<div class="bought-tickects centered hover-effect"></div>
<label>تاریخچه خرید</label>
</div>
<div class="menu-items">
<div class="profile centered hover-effect"></div>
<label>حساب کاربری</label>
</div>
<div class=""></div>
</div>
<div class="clear"></div>
<div class="container-of-selected">
</div>
</body>
CSS
* {
margin: 0px;
padding: 0px;
font-family: Tahoma;
}
.centered {
margin-left: auto;
margin-right: auto;
}
.menu-items {
float: left;
height: 90px;
margin-left: 10px;
margin-right: 10px;
}
.profile {
width: 72px;
height: 72px;
padding-left: 10px;
padding-right: 10px;
background-repeat: no-repeat;
background-position: center;
background-image: url('Images/folder-contacts-icon.png');
border-radius: 5px;
}
.bought-tickects {
width: 72px;
height: 72px;
padding-left: 10px;
padding-right: 10px;
background-repeat: no-repeat;
background-position: center;
background-image: url('Images/tickets-icon.png');
border-radius: 5px;
}
.clear {
clear:both;
}
.user-menu {
margin-left:auto;
margin-right:auto;
}