Bootstrap列未内联显示

编程入门 行业动态 更新时间:2024-10-26 15:19:15
本文介绍了Bootstrap列未内联显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

一般来说,我是Bootstrap和CSS的新手。我有一些看起来像这样的html:

I'm new to bootstrap and CSS in general. I have some html which looks like this:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>My Site</title> <link rel="stylesheet" href="/css/bootstrap-theme.css"> <link rel="stylesheet" href="/css/font-awesome.css"> </head> <body> <div class="container"> <div class="row"> <div class="col-md-1"><span class="fa fa-caret-down"></span></div> <div class="col-md-1"><span id="cool-title">My Site</span></div> <div class="col-md-1"> <input type="text" placeholder="Search" class="search-bar"> </div> <div class="col-md-1"> <button class="btn btn-default"><i class="fa fa-search col-md-1"></i></button> </div> </div> <div id="main"> </div> </div> <script src="/js/jquery.js"></script> <script src="/js/bootstrap.js"></script> </body> </html>

我希望所有这些 col- divs内联,但它们都显示在自己的行上:

I want all of those col- divs to be inlined, but they are all showing up on their own rows:

这是怎么回事?

推荐答案

您正在使用 /css/bootstrap-theme.css 。请使用 /css/bootstrap.css 或 /css/bootstrap.min.css 。 bootstrap-theme.css没有 col-属性。

You are using /css/bootstrap-theme.css. Use /css/bootstrap.css or /css/bootstrap.min.css instead. bootstrap-theme.css doesn't have "col- " properties.

此外,而不是仅使用一个 class = col-md- 1 (对于中等大小的视口/屏幕),您可能希望使用类似 class = col-xs-12 col-sm-6 col-md-3 col- lg-3 可使您的列响应不同的屏幕。 ( xs代表超小屏幕, lg代表大屏幕,等等。使用这些数字。Bootstrap使用12列网格布局,因此使用12的系数作为数字。)

Also, instead of using just one class="col-md-1" (for medium sized viewport/screen) you might want to use something like class="col-xs-12 col-sm-6 col-md-3 col-lg-3" that makes your columns responsive to different screens. ('xs' for extra small screen, 'lg' for large screen etc. Play around with these numbers. Bootstrap uses a 12 columns grid layout, so use factors of 12 as the numbers.)

更多推荐

Bootstrap列未内联显示

本文发布于:2023-11-14 03:08:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586051.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内联   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!