问答详情
源自:4-3 menu

menu不居中

http://img.mukewang.com/59250f2c00014e1012390676.jpg

如上图所示

HTML代码如下:

<!DOCTYPE HTML>

<html>

<head>

<meta charset="utf-8">

<title></title>

<link rel="stylesheet" href="css/reset.css"/>

<link rel="stylesheet" href="css/common.css"/>

<link rel="stylesheet" href="css/index.css"/>

</head>


<body>

<div>

<div class="public-container clearfloat">

<div><a href=""></a></div>

<ul class="header-nav clearfloat">

<li><a href="">Our Story</a></li>

<li><a href="">Menu</a></li>

<li><a href="">Reservations</a></li>

<li><a href="">News</a></li>

<li><a href="">Reviews</a></li>

</ul>

</div>

</div>

<div>

<div><img src="images/demo1.jpg" alt="banner"/></div>

<div>

<div></div>

<p>

<i class="line line-l"></i>

<span>resto restaurant home page website template resto restaurant home page website template</span>

<i class="line line-r"></i>

</p>

</div>

</div>

<div>

<div>The Menu</div>

<div class="public-container menu-list">

<ul>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

<li class="menu-item clearfloat">

<a>

<h4>Voluptate cillum fugiat.</h4>

<p>Cheese, tomato, mushrooms, onions.</p>

</a>

<div></div>

<div>$50</div>

</li>

</ul>

</div>

</div>

<div class="public-container index-panel">Feature Dishes

<div></div>

</div>

<div class="public-container index-panel">The Gallery

<div></div>

</div>

<div class="/*public-container*/ public-footer">

<div class="public-container clearfloat">

<div>

<p>New York Restaurant<br>3926 Anmoore Road<br>New York, NY 10014<br><a href="tel:718-749-1714">718-749-1714</a>

</p>

</div>

<div>

<p>France Restaurant<br>68, rue de la Couronne <br>75002 PARIS<br>02.94.23.69.56</p>

</div>

<div>

<a href="">Blog</a>

<a ref="">Careers</a>

<a ref="">Privacy Policy</a>

<a>Contact</a>

</div>

<div>

<div></div>

<div>© All Rights Reserved 2014. Find  More at Pixelhint.com</div>

</div>

</div>

</div>

</body>

</html>


CSS

.index-banner {

position: relative;

/*background: #b3b3b3;*/

}


.index-banner-bg {

height: 570px;

overflow: hidden;

}


.index-banner-bg img{

margin: 0 auto;

}


.index-banner-text {

position: absolute;

top: 200px;

left: 50%;

margin-left: -388px;

}


.index-banner-text .text-logo {

width: 776px;

height: 117px;

background: url("../images/index-banner-textlogo.png") no-repeat;

}


.index-banner-text .text-info {

margin-top: 17px;

text-align: center;

color: #fff;

}

.index-banner-text .text-info .line {

display: inline-block;

width: 40px;

border-top: 1px solid #fff;

vertical-align: middle;

}


/*.index-banner-text .text-info .line-l {

margin-right: 26px;

}


.index-banner-text .text-info .line-r {

margin-left: 26px;

}*/


.index-banner-text .text-info .txt {

margin: 0 26px;

}


/*菜单*/

.index-menu {

position: relative;

border-top: 4px solid #f34949;

}


.index-menu .menu-tips {

position: absolute;

left: 50%;

top: 0%

margin-left: -78px;

width: 156px;

height: 75px;

text-align: center;

line-height: 65px;

color: #fff;

background: #f34949;

}


.index-menu .menu-tips:after {

position: absolute;

content: "";

left: 0;

bottom: 0;

width: 0;

height: 0;

border-left: 78px solid transparent;

border-right: 78px solid transparent;

border-bottom: 10px solid #fff;

}


.index-menu .menu-list {

margin-top: 150px;

color: #555;

overflow: hidden;

}


.index-menu .menu-list ul {

width: 1160px;

/*background: #003bb3;*/

}


.index-menu .menu-item {

float: left;

width: 520px;

margin-right: 60px;

margin-bottom: 56px;

}


.index-menu .menu-item .title, .index-menu .menu-item .line{

float: left;

}


.index-menu .menu-item .price{

float: right;

}


.index-menu .menu-item .title{

width: 230px;

color: #555;

overflow: hidden;

white-space: nowrap;

text-align: ellipsis;

}


.index-menu .menu-item .comment{

margin-top: 4px;

color: #b7b7b7;

font-size: 12px;

}


.index-menu .menu-item .line{

margin-top: 10px;

width: 192px;

border-top: 1px solid #e3e1e1;

}





提问者:秋名山的豆腐 2017-05-24 12:45

个回答

  • 相守1
    2017-05-26 11:10:15

    html里根本没有index-menu ,menu-tips这两个类,但效果实现了(虽然不居中),估计代码粘贴错了。

  • qq_球球_11
    2017-05-26 10:58:26

    给其设置右边距