两个连续的 HTML 下拉菜单呈现问题
Two consecutive HTML dropdown menus rendering issue
我使用以下代码尝试创建两个下拉菜单;一个用于星期几,另一个用于类别。
<!DOCTYPE html>
<html>
<body>
<p>Category of the article:
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option></p> <br>
<p>Day of publishing the article:
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option></p> <br>
</body>
</html>
但是页面看起来像下图。有人可以帮我确定为什么会这样吗?
您忘记了 <select>
标签。
<!DOCTYPE html>
<html>
<head>
<title>Titre</title>
</head>
<body>
<p>Category of the article:
<select>
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option>
</select></p> <br>
<p>Day of publishing the article:
<select>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
</select></p> <br>
</body>
</html>
此代码在验证器中是正确的,但我不确定您是否可以在 <p>
中添加 <select>
。
错误:
<p>
. 中不能有任何块标记或任何内容
- 您错过了
<select>
个标签。
更正代码:
<!DOCTYPE html>
<html>
<body>
<p>Category of the article:</p>
<select>
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option>
</select>
<p>Day of publishing the article:</p>
<select>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
</select>
</body>
</html>
我使用以下代码尝试创建两个下拉菜单;一个用于星期几,另一个用于类别。
<!DOCTYPE html>
<html>
<body>
<p>Category of the article:
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option></p> <br>
<p>Day of publishing the article:
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option></p> <br>
</body>
</html>
但是页面看起来像下图。有人可以帮我确定为什么会这样吗?
您忘记了 <select>
标签。
<!DOCTYPE html>
<html>
<head>
<title>Titre</title>
</head>
<body>
<p>Category of the article:
<select>
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option>
</select></p> <br>
<p>Day of publishing the article:
<select>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
</select></p> <br>
</body>
</html>
此代码在验证器中是正确的,但我不确定您是否可以在 <p>
中添加 <select>
。
错误:
<p>
. 中不能有任何块标记或任何内容
- 您错过了
<select>
个标签。
更正代码:
<!DOCTYPE html>
<html>
<body>
<p>Category of the article:</p>
<select>
<option value="lifestyle">Lifestyle</option>
<option value="entertainment">Entertainment</option>
<option value="business">Business</option>
<option value="social media">Social Media</option>
<option value="tech">Tech</option>
<option value="world">World</option>
</select>
<p>Day of publishing the article:</p>
<select>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
</select>
</body>
</html>