首页 > 解决方案 > 将 Bootstrap 3 网格应用于特殊的屏幕尺寸

问题描述

我有两个 divcol-xs-12 col-md-9col-xs-12 col-md-3。它们按预期出现

在普通显示器上:

在此处输入图像描述

在手机屏幕上:

在此处输入图像描述

这是我的问题。我必须使布局适应 1300x1900 像素的特殊屏幕。是的,宽度为 1300 像素,高度为 1900 像素。现在它看起来像这样:

在此处输入图像描述

在这种情况下,我需要类似于手机屏幕布局的东西。Bootstrap 3 是否可以处理这种情况,还是我应该手动处理?

编辑:将自定义屏幕宽度添加到现有的 Bootsrap 3 网格并没有真正帮助。问题在于屏幕比例,而不仅仅是绝对屏幕尺寸。

标签: twitter-bootstraptwitter-bootstrap-3bootstrap-grid

解决方案


这是它的代码:

<<!DOCTYPE html>
  <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
  <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
  <!--[if gt IE 8]><!-->
  <html class="no-js">
  <!--<![endif]-->

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <!-- Latest compiled JavaScript -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"></script>
  </head>

  <body>
    <!--[if lt IE 7]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->


    <div class="container-fluid">

      <div class="container-fluid">
        <div class="row">
          <div class="col-xs-12  col-sm-9 col-md-9 col-lg-9 col-xl-12" style="background-color: red">
          abc</div>
          <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3 col-xl-12" style="background-color: blue">
          def</div>
        </div>
      </div>
    </div>
    <script src="" async defer></script>
  </body>

  </html>

看看thr fiddle:https ://jsfiddle.net/8sydhg9y/1/


推荐阅读