我有一个用无序列表创建的菜单。菜单不能超过900px宽,所以我需要我的菜单li文本坐在彼此的顶部。如果不将文本大小缩小到8px,有没有办法对我的菜单项进行“文本换行”,以便它能很好地适应小盒子?
@font-face {
font-family: KBDunkTank;
src:url(KBDunkTank.ttf)
}
ul {
/* margin: 20px 60px;*/
}
ul li {
display: inline-block;
height: 70px;
line-height: 70px;
width: 130px;
margin: 5px 0px 0 0;
text-indent: 15px;
position: relative;
font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
font-size: 12px;
font-style: normal;
font-variant: normal;
font-weight: 500;
text-wrap: break-word;
text-shadow: 0 2px 2px black;
text-decoration:none;
}
ul li:before {
content: " ";
height: 0;
width: 0;
position: absolute;
left: -2px;
border-style: solid;
border-width: 35px 0 35px 40px;
border-color: transparent transparent transparent #fff;
z-index: 0;
text-decoration:none;
}
ul li:first-child:before {
border-color: transparent;
}
ul li a:after {
content: " ";
height: 0;
width: 0;
position: absolute;
right: -40px;
top: 0px;
border-style: solid;
border-width: 35px 0 35px 40px;
border-color: transparent transparent transparent #C34592;
z-index: 10;
text-decoration:none;
}
ul li.active a {
background: #FBE1EE;
z-index: 100;
text-decoration:none;
}
ul li.active a:after {
border-left-color: #FBE1EE;
}
ul li a {
display: block;
background: #C34592;
color: white;
text-decoration:none;
}
ul li a:hover {
background: #E899C9;
}
ul li a:hover:after {
border-color: transparent transparent transparent #E899C9;
}
#box{
width: 900px;
border-style: solid;
border-width: 5px;
}
<ul>
<li><a href="#">Resume</a></li>
<li><a href="#">Pick n Pack Game</a></li>
<li><a href="#">Resume Rubric</a></li>
<li><a href="#">Career Guru</a></li>
<li><a href="#">Self Assessment</a></li>
<li><a href="#">Submit</a></li>
</ul>
答案 0 :(得分:0)
使用'自动换行'修正了它并且随着边框和li的大小调整了很长时间并最终得到它......
ul.progressBar {
/* margin: 20px 60px;*/
}
ul.progressBar li {
display: inline-block;
height: 70px;
line-height: 30px;
width: 130px;
margin: 5px 5px 0 0;
/*text-indent: 20px;*/
position: relative;
font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
font-size: 16px;
font-style: normal;
font-variant: normal;
font-weight: 500;
word-wrap: break-word;
text-shadow: 0px 1px 1px black;
text-decoration:none;
text-align:center;
}
ul.progressBar li:before {
content: " ";
height: 0;
width: 0;
position: absolute;
left: -2px;
border-style: solid;
border-width: 30px 0 30px 40px;
border-color: transparent transparent transparent #fff;
z-index: 0;
text-decoration:none;
}
ul.progressBar li:first-child:before {
border-color: transparent;
}
ul.progressBar li a:after {
content: " ";
height: 0;
width: 0;
position: absolute;
right: -40px;
top: 0px;
border-style: solid;
border-width: 30px 0 30px 40px;
border-color: transparent transparent transparent #C34592; /*Pink: C34592*/
z-index: 10;
text-decoration:none;
}
ul.progressBar li.active a {
background: #FBE1EE;
z-index: 100;
text-decoration:none;
}
ul.progressBar li.active a:after {
border-left-color: #FBE1EE;
}
ul.progressBar li a {
display: block;
background: #C34592; /*Pink: C34592*/
color: black;
text-decoration:none;
padding-left: 30px;
}
ul.progressBar li a:hover {
background: #E899C9; /*Pink: E899C9*/
}
ul.progressBar li a:hover:after {
border-color: transparent transparent transparent #E899C9; /*Pink: E899C9*/
}
<ul class="progressBar">
<li><a href="#">Resume<br><br></a></li>
<li><a href="#">Pick n Pack Game</a></li>
<li><a href="#">Resume<br>Rubric</a></li>
<li><a href="#">Career<br>Guru</a></li>
<li><a href="#">Self<br>Assessment</a></li>
<li><a href="#">Submit<br><br></a></li>
</ul>