user3645310
user3645310

Reputation: 179

Using Bootstrap CDN with DRUPAL

Hi I am using Bootstrap with Drupal. I already installed the bootstrap subtheme, which is provided by Drupal, however if I use my style.css to apply my design changes the default styles of bootstrap are not overwritten.

Does anyone know how I can overwrite these default styles? I am using the Bootstrap CDN, for those who know what it means, it is called method 2 in the official tutorial.

PS:

To specify classes or use !important does not work!

AS REQUESTED IN THE COMMENTS:

I used the exact same structure as stated in this tutorial: https://drupal.org/node/1978010)

Here is the code of my info file:

name = Bootstrap Sub-theme
description = A Bootstrap Sub-theme.
core = 7.x
base theme = bootstrap


;;;;;;;;;;;;;;;;;;;;;
;; Regions
;;;;;;;;;;;;;;;;;;;;;

regions[navigation]     = 'Navigation'
regions[header]         = 'Top Bar'
regions[highlighted]    = 'Highlighted'
regions[help]           = 'Help'
regions[content]        = 'Content'
regions[sidebar_first]  = 'Primary'
regions[sidebar_second] = 'Secondary'
regions[footer]         = 'Footer'
regions[page_top]       = 'Page top'
regions[page_bottom]    = 'Page bottom'


;;;;;;;;;;;;;;;;;;;;;
;; Stylesheets
;;;;;;;;;;;;;;;;;;;;;

stylesheets[all][] = css/style.css


; For information on choosing the desired method, please read the Drupal
; Bootstrap sub-theme "how-to" documentation:
; https://drupal.org/node/1978010

; ;----------------------------------
; ; METHOD 1: Bootstrap Source Files
; ;----------------------------------
; 
; 
;
; ; Disable BootstrapCDN if using Bootstrap source files in your sub-theme.
; settings[bootstrap_cdn] = ''


; ;-------------------------
; ; METHOD 2: Bootstrap CDN
; ;-------------------------
;

 Method 2 uses BootstrapCDN, the only thing you might need to provide here
; is overrides to Bootstrap theme settings. Copy them here from the base theme
; to override.

Upvotes: 0

Views: 3009

Answers (3)

MsC
MsC

Reputation: 199

This problem was probably resolved few years ago. Using Drupal 7.53 and Bootstrap v3, I found no issues using the Starterkit CDN.

I tested this by overriding the starterkit's css and it works.

Since it worked, calling the css through template preprocess function is no longer needed to override the default styles of Bootstrap.

Upvotes: 0

user4338
user4338

Reputation: 173

I've created a file called 'custom.css' and placed it in the 'css'-directory of my bootstrap sub-theme.

Then I added a line to my info file, reading

stylesheets[all][] = css/custom.css

Firing up the web inspector revealed that my custom classes in 'custom.css' have been applied correctly.

Upvotes: 1

vtisnado
vtisnado

Reputation: 500

I had the same issue few days ago and I fixed with the template preprocess function. Just put the following function inside your template.php

function YOUR_THEME_preprocess_html(&$variables) {
  drupal_add_css('/PATH_TO_THEME/custom-style.css');
}

Upvotes: 0

Related Questions