Week 3 Post-class 1.2: Test your Knowledge
这一页有部分内容暂时无法显示,其余内容完整。
Question 1
Which of the following methods can be used to apply CSS styles to an HTML document?
- Inline styles within HTML elements.
- Internal styles within a
<style>element in the HTML document. - External styles via a linked CSS file.
- All of the above.
以下哪种方法可用于将 CSS 样式应用于 HTML 文档?
此处有一段内容暂不支持显示。
- 1 正确:CSS 可以直接写在 HTML 元素的
style属性中,这叫内联样式。 - 2 正确:可以在 HTML 文档的
<head>部分用<style>标签编写内部样式。 - 3 正确:可以通过
<link>标签引用外部 CSS 文件实现样式分离。 - 4 正确:以上三种方式都是合法且常用的 CSS 应用方法,因此正确答案是 “All of the above”。
Question 2
Which CSS selector is used to select elements based on their class attribute?
#classname.classnameclassnameclassname
哪个 CSS 选择器用于根据元素的类属性来选择元素?
此处有一段内容暂不支持显示。
- 1 错误:
#classname用于选择具有特定 id 的元素,而不是 class。 - 2 正确:
.开头的选择器用于匹配具有该 class 属性值的元素,例如.btn会匹配所有class="btn"的元素。 - 3 错误:单独写
classname会被当作标签选择器,匹配<classname>这样的自定义标签,不是 class。 - 4 错误: 是通配符选择器,
classname不是合法的 CSS 选择器写法。
Question 3
What is the main advantage of using Bootstrap for web development?
- It simplifies the addition of server-side logic.
- It ensures consistent, responsive design across various devices and browsers.
- It automates database management.
- It provides a platform for video streaming.
使用 Bootstrap 进行 Web 开发的主要优势是什么?
此处有一段内容暂不支持显示。
- 1 错误:Bootstrap 是前端 UI 框架,与服务器端逻辑无关。
- 2 正确:Bootstrap 提供了统一的样式和响应式布局,确保网页在不同设备和浏览器下都能一致显示。
- 3 错误:数据库管理与 Bootstrap 无关,这是后端或数据库工具的功能。
- 4 错误:Bootstrap 不提供视频流平台,这属于媒体服务领域的功能。
Question 4
In Bootstrap, what does the .container class do?
- Creates a fixed-width container that adjusts based on the screen size.
- Applies a fixed height to the container.
- Removes all padding and margins from the container.
- Creates a full-width container that spans the entire width of the viewport.
在 Bootstrap 中,.container 类起什么作用?
此处有一段内容暂不支持显示。
- 1 正确:
.container会在不同屏幕尺寸下应用不同的最大宽度,从而实现响应式的固定宽度布局。 - 2 错误:
.container不会设置固定高度,高度由内容决定。 - 3 错误:
.container默认会有内边距(padding)以保证内容不贴边,并不会移除它们。 - 4 错误:全宽容器应使用
.container-fluid,不是.container。
Question 5
In Bootstrap's grid system, which class is used to create a column that spans four out of twelve columns available in a row?
.col-12.col-6.col-4.col-3
在 Bootstrap 的网格系统中,哪个类用于创建跨越一行中十二列中的四列的列?
此处有一段内容暂不支持显示。
- 1 错误:
.col-12表示该列占满整行的 12 列。 - 2 错误:
.col-6表示该列占整行的 6 列(即一半)。 - 3 正确:
.col-4表示该列占整行 12 列中的 4 列,即 1/3 的宽度。 - 4 错误:
.col-3表示该列占整行的 3 列(即 1/4 的宽度)。