|
Post by account_disabled on Jan 26, 2024 19:53:02 GMT -8
在本文中,我们将从头开始构建一个响应式 Bootstrap 网站。读完本文后,您将非常熟悉这个流行 CSS 框架的最新版本,以便能够根据项目的需要构建您自己的变体。 Backward Skip 10s Play Video Forward Skip 10s 如今,建立响应式网站是必须的。人们通过各种设备访问网站,而谷歌在分配网页结果排名时强调了响应式网页设计的重要性。 从头开始设计响应式网站对于初学者来说可能是一项艰巨的任务,尽管最新的 Flexbox 和 CSS Grid 规范使得在该领域取得伟大成果比以前容易得多。 然而,对于那些还没有准备好应对尖端布局技术的人来说,Bootstrap 网格仍然提供了一个很好的选择。 “响应式引导网站”是什么意思 当我们使用“响应式设计”这个词时,首先想到的是网站应该兼容各种设备和屏幕尺寸。业界不断要求每个网站都具有响应能力,以便在不同环境下提高在线内容的可读性。 的帮助下,这现在已成为一种巩固的趋势。但如果您是开发人员而不是设计师怎么办?好极了! 嗯,你不用再担心了。由于 Bootstrap 是CSS 框架领域的超级英雄,因此您很快就可以在它的帮助下解决响应式网页设计问题。 配置 确保您获得响应式 Bootstrap 网站 WhatsApp 号码数据 就像在网页头部放置正确的元标记一样简单上面的元标记本质上是不言自明的。我们将页面的宽度设置为设备的宽度,并最初将其缩放为 1(其默认大小)。 除此之外,你就可以开始了:Bootstrap 默认是响应式的。这是我们要构建的页面的演示: Learn to Code with JavaScript 让我们开始构建我们的响应式 Bootstrap 网站 我将上面的响应式网页分为不同的类别,我们将详细了解如何构建每一类: 响应式导航 营销领域 内容部分 右侧边栏 页脚 响应式导航 让我们来构建网站的导航栏。它将包含网站的标题和一些右对齐的菜单链接项。 正如您在演示页面中看到的那样,它将固定在网站的顶部。所以这是这个的标记该类navbar用于显示导航部分。附加的fixed-top类使其粘在页面顶部。和navbar-light类bg-light分别控制导航栏的文本颜色和背景颜色。很清楚! 让我们继续向其中插入更多代码将导航栏内的所有内容作为包装器包含。 到目前为止,我们添加的只是导航栏的基本结构。让我们看看使导航响应的真正神奇的东西。品牌和菜单项是不言自明的。应该清楚的是,添加类navbar-brand可以使标题看起来更干净,并用于网站的名称。这些nav项目被包装在一个附加的div类中这些类用于使菜单在较小的浏览器中查看时看起来像一个堆栈。 就在品牌下方,您可能会看到与navbar-toggler包装 span 的类的附加链接navbar-toggler-icon。此链接仅在带有列表图标的较小屏幕上可见。
|
|