php ul li类和id
我已经看过了,但是人们给出的答案对我的问题没有帮助。相当混乱。 我正在为我的网站创建一个小项目,我正在尝试将其转换为php,以方便页面和维护 我希望它的设置方式就像我现在拥有它一样。但这都是html,每个页面都是自己的html页面,如果我需要编辑或添加到导航栏或其他任何地方,我必须转到每个html并更改它。这是一个很大的禁忌。所以我试图将它转换为php,但我遇到的问题是,奇怪的是,我让它突出显示您现在所在的页面。但是对于php,(我没有所有的链接,所以项目页面和bout会指向html链接),但是主页应该像原始主页一样突出显示 index.php的代码:php ul li类和id,php,html,css,html-lists,Php,Html,Css,Html Lists,我已经看过了,但是人们给出的答案对我的问题没有帮助。相当混乱。 我正在为我的网站创建一个小项目,我正在尝试将其转换为php,以方便页面和维护 我希望它的设置方式就像我现在拥有它一样。但这都是html,每个页面都是自己的html页面,如果我需要编辑或添加到导航栏或其他任何地方,我必须转到每个html并更改它。这是一个很大的禁忌。所以我试图将它转换为php,但我遇到的问题是,奇怪的是,我让它突出显示您现在所在的页面。但是对于php,(我没有所有的链接,所以项目页面和bout会指向html链接),但是
<body bgcolor="#000000" id="home">
<div align="center">
<table class="contentTable" >
<tbody>
<tr>
<td colspan="0" border="0" height="50px" align="center">
<?php include("message.php"); ?>
</td>
</tr>
<tr>
<td colspan="0" border="0" height="125px" align="center">
<?php include("header.php"); ?>
</td>
</tr>
<tr>
<?php include("navbar.php"); ?>
</tr>
<?php include("home.php");?>
</tbody>
</table>
</div>
</body>
Navbar.php的代码:
<td id="navbar">
<ul>
<li onclick="location.href='http://www.soloentertainment.org/index.php';" class="home" title="Home">Home</li>
<li class="projects" title="Projects">Projects</li>
<li class="about" title="About">About</li>
<li>Contact</li>
</ul>
</td>
- 主页
- 项目
- 关于
- 接触
原始index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico">
<title>Solo Entertainment</title>
</head>
<style>
.contentTable {
width: 795px;
border-left: 10px;
border-left-color: #b7ad6f;
border-right: 10px;
border-right-color: #b7ad6f;
margin: 0px;
padding: 0px;
}
.header {
background-color; #000
background-repeat: no-repeat;
background-position: right;
}
#navbar {
width:100%;
height:30px;
background-color:#000;
}
#navbar ul {
width:50%;
margin:0 auto 0 auto;
}
#navbar ul li {
float:left;
color: #FFF;
padding:0 20px 0 20px;
border:1px solid #FFF;
height:30px;
list-style:none;
display:block;
line-height:30px;
text-align:center;
cursor:pointer;
}
#navbar ul li:hover {
background-color:#CCC;
color: #000;
}
#home #menu .home, #projects #menu .projects {
background-color:#FFF;
color: #111
}
</style>
<body bgcolor="#000000" id="home">
<div align="center" id="menu">
<table class="contentTable">
<tbody>
<tr>
<td colspan="2" border="0" height="55px" align="center">
<font color="#FF0000" size="+2">This site is still being built. Please be Patient</font>
</td>
</tr>
<tr>
<td colspan="2" class="header" align="left" border="0" height="125px">
<img src="images/solo.png" width="785" height="112" alt="Title" title="Solo Enertainment" border="0">
</td>
</tr>
<tr>
<td id="navbar">
<ul>
<li onclick="location.href='http://www.soloentertainment.org';" class="home" title="Home">Home</li>
<li onclick="location.href='http://www.soloentertainment.org/projects';" class="projects" title="Projects">Projects</li>
<li onclick="location.href='http://www.soloentertainment.org/about';" class="about" title="About">About</li>
<li>Contact</li>
</ul>
</td>
</tr>
<tr>
<td colspan="2" class="header" align="center" border="0" height="100px">
<font color="#FFFFFF" size=""> Welcome to Solo Entertainment, One Man One Show.</font>
</td>
</tr>
<tr>
<td colspan="2" class="header" align="Center" border="0">
<img src="./images/kyleandsteve1280.jpg" width="307" height="245" />
<br />
<font color="#FFFFFF">Kyle and Steve Save the world.
<br />
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
个人娱乐
.可满足{
宽度:795px;
左边框:10px;
左边框颜色:#b7ad6f;
右边界:10px;
右边框颜色:#b7ad6f;
边际:0px;
填充:0px;
}
.标题{
背景色;#000
背景重复:无重复;
背景位置:右;
}
#导航栏{
宽度:100%;
高度:30px;
背景色:#000;
}
#纳瓦尔{
宽度:50%;
边距:0自动0自动;
}
#纳瓦尔里酒店{
浮动:左;
颜色:#FFF;
填充:0 20px 0 20px;
边框:1px实心#FFF;
高度:30px;
列表样式:无;
显示:块;
线高:30px;
文本对齐:居中;
光标:指针;
}
#navbar ul li:悬停{
背景色:#CCC;
颜色:#000;
}
#主页#菜单。主页,#项目#菜单。项目{
背景色:#FFF;
颜色:#111
}
这个网站仍在建设中。请耐心点
- 主页
- 项目
- 关于
- 接触
欢迎来到单人娱乐,一人一秀。
凯尔和史蒂夫拯救了世界。
现在,我不明白为什么主页在html中突出显示,而不是在php中突出显示?使突出显示的css如下所示:
#home #menu .home, #projects #menu .projects {
background-color: #FFFFFF;
color: #111111;
}
在PHP文件中,带有.home
类的按钮位于带有#home
id的元素下,但没有带有#menu
id的元素
这是HTML中的一部分:
<body bgcolor="#000000" id="home">
<div align="center" id="menu">
这是PHP中的一部分:
<body bgcolor="#000000" id="home">
<div align="center">
特别是
。这是如何删除的。哦,伙计。昨天我花了一整天的时间试图找出错误。哇!非常感谢你。我现在觉得自己太迟钝了。和他在一起真的很容易找到。你在用吗?这就是你不复制粘贴的结果。哈哈。重新写一遍只是因为对php脚本不太熟悉。我向你保证,当你习惯用php包含页面部分后,你不会明白没有它你怎么能做任何事情。当你到达那里,我建议你开始阅读。你在index.php中包含你的风格了吗?原始index.html页面中有内联样式,但index.php中没有