SlideShare a Scribd company logo
1 of 4
Download to read offline
Bootstrap
http://getbootstrap.com
★ Bootstrap is “mobile first”
- "Mobile First", meaning that almost everything has been ​redesigned ​to start
from a lower screen size and scale up (more on that in a bit).
- With Bootstrap 2, it added ​optional ​mobile friendly styles for key aspects of
the framework.
- With Bootstrap 3, it have ​rewritten ​the project to be mobile friendly from the
start. Instead of adding on optional mobile styles, they're baked right into the
core. In fact, Bootstrap is mobile first. Mobile first styles can be found
throughout the entire library instead of in separate files.
★ To ensure proper rendering and touch zooming, add the ​viewport meta ​tag to your
<head>​: ​<meta name="viewport" content="width=device-width, initial-scale=1">
★ You can ​disable ​zooming capabilities on mobile devices by adding ​user-scalable=no
to the viewport meta tag. This disables zooming, meaning users are only able to
scroll, and results in your site feeling a bit more like a native application. Overall,
we don't recommend this on every site, so use caution!
<meta name="viewport" content="width=device-width, initial-scale=1,
maximum-scale=1, user-scalable=no">
★ Disabling responsiveness:
- Bootstrap automatically adapts your pages for various screen sizes.
- Steps to disable page responsiveness
1. Omit the viewport ​<meta>​mentioned in above.
2. Override the ​width ​on the ​.container​for each grid tier with a single
width, for example width: 970px !important; Be sure that this comes
after the default Bootstrap CSS. You can optionally avoid the !important
with media queries.
3. If using navbars, remove all navbar collapsing and expanding behavior.
4. For grid layouts, use .col-xs-* classes in addition to, or in place of, the
medium/large ones. Don't worry, the extra-small device grid scales to all
resolutions.
You'll still need Respond.js for IE8 (since our media queries are still there and
need to be processed). This disables the "mobile site" aspects of Bootstrap.
★ Media queries:
Bootstrap has ​clearly defined breakpoints​for different kinds of devices, specified by
using CSS media queries. The following are the breakpoint categories used for the
different types of devices:
1. Extra Small Devices (e.g. cell phones) are the default, creating the “mobile first”
concept in Bootstrap. This covers devices smaller than 768px wide.
2. “Small Devices” (e.g. tablets) are targeted with:
@media (min-width: 768px) and (max-width: 991px) { ... }
3. Medium Sized Devices (e.g. Desktops) have a screen size smaller than 1200px
and greater than 991px, targeted using:
@media (min-width: 992px) and (max-width: 1199px) { ... }.
4. Larger Devices (e.g. wide-screen monitors) are greater than 1200px, targeted
using:
@media (min-width: 1200px) { ... }
★ Responsive utilities:
- For faster mobile-friendly development, use these utility classes for ​showing
and ​hiding ​content by device via media query. Also included are utility classes
for toggling content when printed.
- Use a single or combination of the available classes for toggling content across
viewport breakpoints.
Extra small devices
Phones (<768px)
Small devices
Tablets (≥768px)
Medium devices
Desktops (≥992px)
Large devices
Desktops (≥1200px)
.visible-xs-* Visible Hidden Hidden Hidden
.visible-sm-* Hidden Visible Hidden Hidden
.visible-md-* Hidden Hidden Visible Hidden
.visible-lg-* Hidden Hidden Hidden Visible
.hidden-xs Hidden Visible Visible Visible
.hidden-sm Visible Hidden Visible Visible
.hidden-md Visible Visible Hidden Visible
.hidden-lg Visible Visible Visible Hidden
★ Steps to apply Bootstrap to a Rails application:
1. add a gem to the ​Gemfile
2. modify the file ​app/assets/javascripts/application.js​to add Bootstrap’s
Javascript files
3. add the file ​app/assets/stylesheets/framework_and_overrides.css.scss​to
add Bootstrap’s CSS files
4. modify the file ​app/views/layouts/application.html.erb​to change the
application layout
gem 'bootstrap-sass', '~> 3.2.0'
gem 'twitter-bootstrap-rails'
gem 'sass-rails', '~> 3.2.3' (out assets group)
group :development do
gem 'rails_layout'
end
$ bundle install
$ rails generate layout:install bootstrap3
In app/assets/application.css.scss:
@import "bootstrap-sprockets";
@import "bootstrap";
In app/assets/application.js:
//= require jquery
//= require bootstrap-sprockets
Do not use //= require in Sass or your other stylesheets will not be ​able to access​the
Bootstrap mixins or variables.
★ Others
- Change title of tooltip:
$(this).tooltip('hide').attr('data-original-title', 'new text') .tooltip('show');
- Tag inputs:
http://timschlechter.github.io/bootstrap-tagsinput/examples/
★ References:
http://getbootstrap.com/getting-started/#disable-responsive
http://getbootstrap.com/css/#responsive-utilities
https://github.com/twbs/bootstrap-sass
https://github.com/RailsApps/rails_layout
★ Developer​: ​Nguyễn Thành Luân

More Related Content

Similar to Bootstrap Tutorial

Designing for mobile
Designing for mobileDesigning for mobile
Designing for mobileDee Sadler
 
Responsive website design
Responsive website designResponsive website design
Responsive website designsvaithiyalingam
 
Stc 2015 preparing legacy projects for responsive design - design issues
Stc 2015   preparing legacy projects for responsive design - design issuesStc 2015   preparing legacy projects for responsive design - design issues
Stc 2015 preparing legacy projects for responsive design - design issuesNeil Perlin
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12touchtitans
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap1amitgupta
 
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
CSS3 Media Queries: Mobile Elixir or CSS Snake OilCSS3 Media Queries: Mobile Elixir or CSS Snake Oil
CSS3 Media Queries: Mobile Elixir or CSS Snake Oiljameswillweb
 
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Patrick Lauke
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3Lanh Le
 
HTML & CSS #10 : Bootstrap
HTML & CSS #10 : BootstrapHTML & CSS #10 : Bootstrap
HTML & CSS #10 : BootstrapJean Michel
 
Responsive web design
Responsive web designResponsive web design
Responsive web designpsophy
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteJj Jurgens
 
HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)Andi Farr
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Andreas Bovens
 
Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Patrick Lauke
 
Proactive Responsive Design
Proactive Responsive DesignProactive Responsive Design
Proactive Responsive DesignNathan Smith
 
Dynamic User Interfaces for Desktop and Mobile
Dynamic User Interfaces for Desktop and MobileDynamic User Interfaces for Desktop and Mobile
Dynamic User Interfaces for Desktop and Mobilepeychevi
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 mayLuciano Amodio
 

Similar to Bootstrap Tutorial (20)

Designing for mobile
Designing for mobileDesigning for mobile
Designing for mobile
 
Responsive website design
Responsive website designResponsive website design
Responsive website design
 
Stc 2015 preparing legacy projects for responsive design - design issues
Stc 2015   preparing legacy projects for responsive design - design issuesStc 2015   preparing legacy projects for responsive design - design issues
Stc 2015 preparing legacy projects for responsive design - design issues
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
 
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
CSS3 Media Queries: Mobile Elixir or CSS Snake OilCSS3 Media Queries: Mobile Elixir or CSS Snake Oil
CSS3 Media Queries: Mobile Elixir or CSS Snake Oil
 
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
Adapt and respond - mobile-friendly layouts beyond the desktop - standards>ne...
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
HTML & CSS #10 : Bootstrap
HTML & CSS #10 : BootstrapHTML & CSS #10 : Bootstrap
HTML & CSS #10 : Bootstrap
 
Dig into the omega theme
Dig into the omega themeDig into the omega theme
Dig into the omega theme
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)HTML5 apps for iOS (and probably beyond)
HTML5 apps for iOS (and probably beyond)
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
 
Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011Adaptive layouts - standards>next Manchester 23.03.2011
Adaptive layouts - standards>next Manchester 23.03.2011
 
Proactive Responsive Design
Proactive Responsive DesignProactive Responsive Design
Proactive Responsive Design
 
Dynamic User Interfaces for Desktop and Mobile
Dynamic User Interfaces for Desktop and MobileDynamic User Interfaces for Desktop and Mobile
Dynamic User Interfaces for Desktop and Mobile
 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
 

Recently uploaded

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Bootstrap Tutorial

  • 1. Bootstrap http://getbootstrap.com ★ Bootstrap is “mobile first” - "Mobile First", meaning that almost everything has been ​redesigned ​to start from a lower screen size and scale up (more on that in a bit). - With Bootstrap 2, it added ​optional ​mobile friendly styles for key aspects of the framework. - With Bootstrap 3, it have ​rewritten ​the project to be mobile friendly from the start. Instead of adding on optional mobile styles, they're baked right into the core. In fact, Bootstrap is mobile first. Mobile first styles can be found throughout the entire library instead of in separate files. ★ To ensure proper rendering and touch zooming, add the ​viewport meta ​tag to your <head>​: ​<meta name="viewport" content="width=device-width, initial-scale=1"> ★ You can ​disable ​zooming capabilities on mobile devices by adding ​user-scalable=no to the viewport meta tag. This disables zooming, meaning users are only able to scroll, and results in your site feeling a bit more like a native application. Overall, we don't recommend this on every site, so use caution! <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> ★ Disabling responsiveness: - Bootstrap automatically adapts your pages for various screen sizes. - Steps to disable page responsiveness 1. Omit the viewport ​<meta>​mentioned in above. 2. Override the ​width ​on the ​.container​for each grid tier with a single width, for example width: 970px !important; Be sure that this comes
  • 2. after the default Bootstrap CSS. You can optionally avoid the !important with media queries. 3. If using navbars, remove all navbar collapsing and expanding behavior. 4. For grid layouts, use .col-xs-* classes in addition to, or in place of, the medium/large ones. Don't worry, the extra-small device grid scales to all resolutions. You'll still need Respond.js for IE8 (since our media queries are still there and need to be processed). This disables the "mobile site" aspects of Bootstrap. ★ Media queries: Bootstrap has ​clearly defined breakpoints​for different kinds of devices, specified by using CSS media queries. The following are the breakpoint categories used for the different types of devices: 1. Extra Small Devices (e.g. cell phones) are the default, creating the “mobile first” concept in Bootstrap. This covers devices smaller than 768px wide. 2. “Small Devices” (e.g. tablets) are targeted with: @media (min-width: 768px) and (max-width: 991px) { ... } 3. Medium Sized Devices (e.g. Desktops) have a screen size smaller than 1200px and greater than 991px, targeted using: @media (min-width: 992px) and (max-width: 1199px) { ... }. 4. Larger Devices (e.g. wide-screen monitors) are greater than 1200px, targeted using: @media (min-width: 1200px) { ... } ★ Responsive utilities: - For faster mobile-friendly development, use these utility classes for ​showing and ​hiding ​content by device via media query. Also included are utility classes for toggling content when printed. - Use a single or combination of the available classes for toggling content across viewport breakpoints.
  • 3. Extra small devices Phones (<768px) Small devices Tablets (≥768px) Medium devices Desktops (≥992px) Large devices Desktops (≥1200px) .visible-xs-* Visible Hidden Hidden Hidden .visible-sm-* Hidden Visible Hidden Hidden .visible-md-* Hidden Hidden Visible Hidden .visible-lg-* Hidden Hidden Hidden Visible .hidden-xs Hidden Visible Visible Visible .hidden-sm Visible Hidden Visible Visible .hidden-md Visible Visible Hidden Visible .hidden-lg Visible Visible Visible Hidden ★ Steps to apply Bootstrap to a Rails application: 1. add a gem to the ​Gemfile 2. modify the file ​app/assets/javascripts/application.js​to add Bootstrap’s Javascript files 3. add the file ​app/assets/stylesheets/framework_and_overrides.css.scss​to add Bootstrap’s CSS files 4. modify the file ​app/views/layouts/application.html.erb​to change the application layout gem 'bootstrap-sass', '~> 3.2.0' gem 'twitter-bootstrap-rails' gem 'sass-rails', '~> 3.2.3' (out assets group) group :development do gem 'rails_layout' end
  • 4. $ bundle install $ rails generate layout:install bootstrap3 In app/assets/application.css.scss: @import "bootstrap-sprockets"; @import "bootstrap"; In app/assets/application.js: //= require jquery //= require bootstrap-sprockets Do not use //= require in Sass or your other stylesheets will not be ​able to access​the Bootstrap mixins or variables. ★ Others - Change title of tooltip: $(this).tooltip('hide').attr('data-original-title', 'new text') .tooltip('show'); - Tag inputs: http://timschlechter.github.io/bootstrap-tagsinput/examples/ ★ References: http://getbootstrap.com/getting-started/#disable-responsive http://getbootstrap.com/css/#responsive-utilities https://github.com/twbs/bootstrap-sass https://github.com/RailsApps/rails_layout ★ Developer​: ​Nguyễn Thành Luân