0

I am new to Drupal 8 platform. To start with I am trying to create a responsive layout using Bootstrap, but I don't want to use ready-made bootstrap theme provided by Drupal. Folder structure of my theme looks like this:

themes  
  custom  
    lexus  
      css  
        style.css  
      includes  
        bootstrap  
          bootstrap-theme.css  
          bootstrap-theme.css.map  
          bootstrap.css
      templates  
          page.html.twig
      lexus.libraries.yml  
      lexus.info.yml

Content of page.html.twig

<div id="page">
  {% if page.headline %}
     <section id="headline">
        <div class= "container">
             {{ page.headline }}
        </div>
     </section>
    {% endif %}


  <header id="header" class="header">
    <div class="container">
        {{ page.header }}
    </div>
  </header>

  <section id="main">
    <div class="container">
        <div class="row">
            <div id="content" class="col-md-9 col-sm-9 col-xs-12">
                {{ page.content }}
            </div>
          {% if page.sidebar_first %}
            <aside id="sidebar" class="sidebar col-md-3 col-sm-3 col-xs-12">
                 {{ page.sidebar_first}}
            </aside>
           {% endif %}
        </div>
    </div>
    </section>

  {% if page.footer %}
    <footer id="footer" class>
      <div class="container">
        {{ page.footer }}
      </div>
    </footer>
  {% endif %}
</div>

Content of lexus.info.yml

name: Lexus
description: Two column responsive layout
type: theme
core: 8.x
version: 8.2.0
base theme: bartik
libraries:
  - lexus/global-styling

Content of lexus.libraries.yml

global-styling:
  css:
    theme:
      includes/bootstrap/css/bootstrap.css: {}
      css/style.css: {}

When the site loads in desktop view it does not seem to be using bootstrap column arrangements. The content section is taking up entire browser width and pushing sidebar_first contents below it. Here is a screenshot of my desktop view:

enter image description here

But when I resize my browser to mobile view it looks like the responsiveness works. Here is the screenshot of mobile view.

enter image description here

Please help me understand what I am doing wrong.

Subrata Sarkar
  • 2,975
  • 6
  • 45
  • 85

1 Answers1

0

This could be due to your device being considered "large" by bootstrap when it is maximised. You don't currently have a "col-lg-X" class. Try changing

<div id="content" class="col-md-9 col-sm-9 col-xs-12">

to

<div id="content" class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
Kaizen9001
  • 510
  • 1
  • 4
  • 11