gpt4 book ai didi

html - 包含多个 div 标签?

转载 作者:太空宇宙 更新时间:2023-11-04 08:58:34 25 4
gpt4 key购买 nike

我的主要问题是理解书中这一步的要求。它逐字逐句地说。

"在 h2 标题下,插入一个包含类值表的 div 元素的新行,缩进级别与上一行相同。在商店营业时间信息的最后一行下方为 div 元素添加一个结束标记。附上每行代码在类值为“行”的 div 元素中包含商店营业时间信息,然后从每行中删除开始和结束 p 标签。对于每一行,将星期几的缩写包含在 div 元素中,删除其后的冒号 (:),将该行的其余部分移至新行,然后将新行的内容包含在 div 元素中。"

我已经删除了 p 标签并开始放入 div 标签,直到我对它们应该放在哪里感到困惑。谁能告诉我每个 div 标签应该在哪里?今晚到期,我已经知道我的老师不会在一天结束前回复,因为这是大学教授最擅长的。

/* 
Spotted Wren Garden Center style sheet
Filename: styles.css

Author: Justus Self
Date: 3/21/17
HTML5 and CSS3 Illustrated Unit H, Independent Challenge 1
*/

/* reset styles */
html {
font-size: 18px;
}
article, body, div, figcaption, dd, dl, dt, ul, li, figure, footer, header, h1, h2, h3, img, nav, p, table, tbody, td, tfoot, th, thead, tr {
border: 0;
padding: 0;
margin: 0;
border-collapse: collapse;
list-style-type: none;
}
img {
max-width: 100%;
height: auto;
width: auto;
}

/* global styles */
p {
margin: 0.4em 0;
font-size: 1.1em;
}

/* body and page container */
body {
font-family: Lato, Arial, Helvetica, sans-serif;
background: #6ac238;
}
.container {
max-width: 864px;
margin: 0 auto;
position: relative;
}

/* skip navigation link */
p.skipnavigation {
margin: 0;
}
p.skipnavigation a {
position: absolute;
left: -10000px;
}
p.skipnavigation a:focus {
color: black;
background-color: snow;
top: 3.5%;
left: auto;
right: 3%;
z-index: 2;
}

/* header section */
header {
background-color: white;
text-align: center;
}
h1 {
font-weight: 700;
font-size: 2em;
}
h1 img {
display: block;
}

/* site navigation */
nav.sitenavigation {
padding-left: 10%;
background-color: rgb(241,90,36);
}
nav.sitenavigation li {
display: inline-block;
margin: 0.4em 0.6em;
font-size: 1.1em;
}
nav.sitenavigation a:link {
color: yellow;
text-decoration: none;
}
nav.sitenavigation a:visited {
color: #ffffff;
}
nav.sitenavigation a:hover, nav.sitenavigation a:focus {
color: yellow;
text-shadow: 1px -1px 0 #000000;
}

/* main content */
article {
padding: 1% 1% 1% 5%;
text-align: left;
background-color: rgb(255,255,255);
overflow: auto;
}
h2 {
margin: 0 0 0.4em;
font-size: 1.8em;
font-weight: 700;
}
h3 {
margin: 1em 0 0.5em;
font-size: 1.2em;
font-weight: bold;
color: green;
}
figure {
width: 40%;
float: right;
text-align: center;
}
.scientific-name {
font-style: italic;
}

/* main content table */
th, td {
border: 1px solid black;
padding: 0.5em;
}

th {
background-color: yellow;
}
.temps {
background-color: #87f547;
}

.frost {
background-color: #f5a88c;
}

/* Main Content Description List */
dd {
margin-left: 1em;
font-style: italic;
}

/* Main Content CSS Table */
.table {
margin: 1em 0;
font-size: 1.3em;
display: table;
}
.row {
display: table-row;
}
.row div {
padding: 0.25em 0.5em;
display: table-cell;
}
.day {
font-weight: bold;
}
/* footer section */
footer {
padding: 1% 1% 1% 5%;
background-color: yellow;
clear: both;
}

/* print styles */
@media print {
.container, h1, h2, p {
color: black;
background: white;
}
nav {
display: none;
}
}
@page {
margin: 1in;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Spotted Wren Garden Center - Hours</title>
<!--
Spotted Wren Garden Center Hours page
Filename: hours.html

Author: Justus Self
Date: 3/21/17
HTML5 and CSS3 Illustrated Unit H, Independent Challenge 1
-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="modernizr.custom.40753.js"></script>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="styles.css">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="icon" sizes="192x192" href="images/android.png">
</head>
<body>
<div class="container">
<p class="skipnavigation"><a href="#contentstart">Skip navigation</a></p>
<header>
<h1><a href="index.html"><img src="images/spotwren.gif" width="864" height="184" alt="Spotted Wren Garden Center"></a></h1>
</header>
<nav class="sitenavigation">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="hours.html">Hours</a></li>
<li><a href="resource.html">Resources</a></li>
<li><a href="consult.html">Consulting</a></li>
</ul>
</nav>
<article>
<figure id="contentstart">
<img src="images/cone.jpg" height="301" width="200" alt="a monarch butterfly on a purple coneflower">
<figcaption>Purple Coneflower</figcaption>
</figure>
<h2>Hours</h2>
<div class="table">
<div class="row"> <div>Mon</div>
<div> 8am &mdash; 8pm</div>
<div class="row">Tue: 8am &mdash; 8pm</div>
<div class="row">Wed: 8am &mdash; 5pm</div>
<div class="row">Thu: 8am &mdash; 8pm</div>
<div class="row">Fri: 8am &mdash; 8pm</div>
<div class="row">Sat: 9am &mdash; 6pm</div>
<div class="row">Sun: 11am &mdash; 6pm</div>
</div>
</article>
<footer>
<p>548 N. 58th St. &#8226; Omaha, NE 68132 &#8226; (402) 555-9736</p>
</footer>
</div>
</body>
</html>

最佳答案

  1. 让我们从这一行开始,逐步按照说明操作:

<div class="row">Tue: 8am &mdash; 8pm</div>

  1. 对于每一行,将星期几的缩写包含在一个 div 元素中 [...]

<div class="row"><div>Tue</div>: 8am &mdash; 8pm</div>

  1. [...] 删除后面的冒号 (:) [...]

<div class="row"><div>Tue</div> 8am &mdash; 8pm</div>

  1. [...] 将行的剩余部分移到新行中 [...]


<div class="row"><div>Tue</div>
8am &mdash; 8pm</div>

  1. [...] 然后将新行的内容包含在一个 div 元素中 [...]


<div class="row"><div>Tue</div>
<div>8am &mdash; 8pm</div></div>

关于html - 包含多个 div 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42939233/

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