我有一些共享通用CSS文件的HTML页面。我将它们放在标题中,并将其导入页面中。一切都很好,但是,我必须返回带有ID的一页,它不起作用。
我有一个页面detail.html
,但是当我返回一个detail/id
时它不会收费。不能是href错误,因为其他页面正在收费。我想我必须更改某些内容,以便将其应用于所有地方?
<!DOCTYPE html>
<html lang="es">
<head>
<title>Historiales Médicos</title>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Página home">
<meta name="author" content="Lucas Mazariegos">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Favicon -->
<link rel="icon" href="img/favicon2.png" type="image/png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<!-- CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/estilo.css" type="text/css">
</head>
以及我得到的URL:detail / 1_S0004-06142005000900012-1。 HTML收费,而CSS收费。
我相信您的问题是CSS文件href="css/estilo.css"
位于相对于页面URL的位置。
如果页面URL为http://example.com/detail
,则CSS文件位于网站的根目录中。然后,当URL更改为http://example.com/detail/id
时,引用css/estilo.css
应该位于目录位置/detail/id/estilo.css
中。
[我建议您将所有全局CSS放在一个名为“ css”的根目录中,然后您的href将变为href=/css/estilo.css
,它不会随着页面URL的更改而更改。