我在我的jsp页面中插入了一些代码HTML:acceuil.jsp但是我的标签中出现了错误<div class="ca-content">.它告诉我它是一个无效的位置.(ca-content指的是我样式表中的一个类).
我试图禁用HTML验证器,但我仍然有同样的错误.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/acceuil.css" />
<title>Insert title here</title>
</head>
<body>
<ul class="ca-menu">
<li>
<a href="#">
<span class="ca-icon">A</span>
<div class="ca-content">
<h2 class="ca-main">Exceptional Service</h2>
<h3 class="ca-sub">Personalized to your needs</h3>
</div>
</a>
</li>
</ul>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
<div>在一个内部无效<a>.
在HTML 4.1规范中,<a>元素可能只包含内联元素并且<div>是块元素,因此它可能不会出现在内部<a>.
所以与其:
<a href="#">
<span class="ca-icon">A</span>
<div class="ca-content">
<h2 class="ca-main">Exceptional Service</h2>
<h3 class="ca-sub">Personalized to your needs</h3>
</div>
</a>
Run Code Online (Sandbox Code Playgroud)
使用:
<a href="#">
<span class="ca-icon">A</span>
</a>
<div class="ca-content">
<h2 class="ca-main">Exceptional Service</h2>
<h3 class="ca-sub">Personalized to your needs</h3>
</div>
Run Code Online (Sandbox Code Playgroud)
或者其他代表你需要的东西,但总是在<div>外面<a>
看看HTML 5规范中的" The a element",可能会对你有帮助.
| 归档时间: |
|
| 查看次数: |
15074 次 |
| 最近记录: |