【发布时间】:2014-10-26 23:14:36
【问题描述】:
目前我的 html 页面有一些小问题。
该页面设置有 2 篇博文。它们都使用<li> 在自己的边界部分中。
我也使用<li> 进行导航和博客文章,但两者的样式都在变化。
我知道这一定与创建类或 ID 或其他东西有关,但我就是无法让它工作。提前致谢!!
任何指点将非常感谢!
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="coursework1.css" rel="stylesheet" type="text/css">
<title>Hobbies</title>
<script src="scripts/jquery-1.11.1.min.js"></script>
<script src="scripts/modernizr-custom.73764.js"></script>
<script src="scripts/webshim/polyfiller.js"></script>
<script>
$.webshims.polyfill('mediaelement');
</script>
</head>
<body>
<h1> Hobbies </h1>
<nav class="nav">
<li><a href="/about/">About</a></li>
<li><a href="/work/">Hobbies</a></li>
<li><a href="/clients/">Newsletter</a></li>
</nav>
<p>
<ul>
<li>
<p> <h2> Pompey Win! - March 14, 2012 </h2> </p>
<img class="focus pic" src="pompeygoal.jpg"
style="float:left; width:400px; height:300px; border:none;"
/>
<img class="focus pic" src="pompeychallenge.jpg"
style="margin-left: 50px; width:400px; height:300px; border:none;"
/>
<img class="focus pic" src="andyawford.jpg"
style="float:right; width:400px; height:300px; border:none;"
/>
<p> On tuesday evening of this week, I went to Portsmouth. Unfortunately, I do support them... But being the good fan I am , I still made the trip down to the south coast to show my support. It turned out to be a really good evening though as we ended up winning 3-2!</p>
</li>
<li>
<p> <h2>Notting Hill Carnvial - March 13, 2012 </h2> </p>
<video width="480" height="360" controls id="nhVid">
<source src="NottingHillVid.mp4" type="video/mp4">
<source src="NottinHillVid.webm" type="video/webm"> </video>
<p> Every summer, I always look forward to Notting Hill Carnival. This year was my third year, and I had a great time. It was extremely wet, however this did not dampen spirits and everyone still had a smile on their face. I saw loads of music and also had some really great jerk chicken. <p>
</li>
</ol>
</body>
</html>
CSS:
@charset "UTF-8";
body {
background-color:#808080;
font-family:symbol, 'Standard Symbols L';
margin: 0 0 100px;
}
h1 {
text-align: center;
color: white;
text-shadow: 2px 2px #000000;
font-size:350%;
}
h2 {
color: white;
font-size:30px;
text-align:center;
}
#tableAbout {
width:100%; cellpadding:10; cellspacing:5;
font-family: Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
color: white; table align:center;
}
.nav{
list-style:none;
text-align:center;
border-style: solid;
border-width: 2px;
background: -webkit-linear-gradient(grey, black);
background: -o-linear-gradient(grey, black);
background: linear-gradient(grey, black);
}
.nav li{
display:inline;
}
.nav a{
display:inline-block;
padding:10px;
transition: all 0.2s ease-in;
color: white;
font-size:25px;
}
.nav a:hover{
-webkit-stroke-width: 5.3px;
-webkit-stroke-color: #FFFFFF;
-webkit-fill-color: #FFFFFF;
text-shadow: 1px 1px 20px white;
}
td[target] {
font-weight: bold;
}
#newsletterForm {
color: white;
}
footer {
position:absolute;
bottom:0;
width:100%;
height:60px;
clear:both;
left: 0;
font-color:black;
text-align: center;
font-weight: bold;
font-family: Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
}
html {
position: relative;
min-height: 100%;
}
.focus {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.focus:hover {
border: 70px solid #000;
border-radius: 50%;
}
li {
background-color: rgba(194, 181, 158, .5);
border: 1px solid rgb(194, 181, 158);
border-radius: 10px;
margin: 10px 0;
padding:10px;
}
li:nth-child(even){
background-color: rgba(242, 224, 131, .5);
border: 1px solid rgb(242, 224, 131);
}
ul
{
list-style-type: none;
}
【问题讨论】:
-
你需要在每个 li 上使用一个类。 PS 发布代码比提供下载 zip 的链接更好
-
能否请您发布工作代码?我已经用类尝试了很多东西,但我仍然无法让它工作
-
你正在打开一个 ul 标签并用 ol 标签关闭它。