gpt4 book ai didi

php - 为什么不同的 HTML id 具有相同的样式?

转载 作者:行者123 更新时间:2023-11-28 15:16:47 25 4
gpt4 key购买 nike

我有两个 ID 不同的表,它们位于不同的页面中。单独它们都很好,但是当我将它们包含在单个页面中时,尽管 HTML 元素的 id 不同,样式还是重叠的。下面是我的代码:

<head>

<rel="Stylesheet" href="CSS/styles.css">

</head>

<body>
<table id="logo" style="width:100%">
<th><img src="Image/vg_logo.png" style="width:150px;height:100px"></th>
</table>
</body>

上面代码的样式是:

#logo{
border: none;
}

另一个元素代码是:

    $query="select * from users order by id";
$result=mysqli_query($con,$query);
echo '<table id="userTable"><tr><th>User ID</th><th>Full Name</th><th>User Name</th><th>User Role</th></tr>';

while ($row=mysqli_fetch_array($result))
{
echo '<tr><td>'.$row['id'].'</td><td>'.$row['userFullName'].'</td><td>'.$row['userName'].'</td><td>'.$row['type'].'</td></tr>';
}
echo '</table>';

风格是:

#userTable{
float:right;
width: 550px;
}
#userTable, th, td{
border: 1px solid black;
border-collapse: collapse;
font-family:tahoma;
font-size:14px;
}

th{
background-color: #a1aec4;
}

现在的问题是,每当我将第一个页面与第二个页面包含在一起时,第一个表就会有边框。我在哪里设置了 border:none,为什么会这样?

最佳答案

在您的 CSS 中更改这一行:

#userTable, th, td{

#userTable, #userTable th, #userTable td{

关于php - 为什么不同的 HTML id 具有相同的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42340443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com