Boot st r ap Q ui ck G ui de Boot st r ap Q ui ck G ui de Boot st r ap Q ui ck

Boot st r ap Q ui ck G ui de Boot st r ap Q ui ck G ui de Boot st r ap Q ui ck G ui de Bootstrap Quick Guide Bootstrap Quick Guide Overview Overview What is Twitter Bootstrap? What is Twitter Bootstrap? Bootstrap is a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. It uses HTML, CSS and Javascript. History History Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter. It was released as an open source product in August 2011 on GitHub. Why use Bootstrap? Why use Bootstrap? Mobile first approach: Since Bootstrap 3, the framework consists of Mobile first styles throughout the entire library instead of in separate files. Browser Support: It is supported by all popular browsers. Easy to get started: With just the knowledge of HTML and CSS anyone can get started with Bootstrap. Also the Bootstrap official site has a good documentation. Responsive design: Bootstrap's responsive CSS adjusts to Desktops,T ablets and Mobiles. More about responsive design in the chapter Bootstrap Responsive Design Provides a clean and uniform solution for building an interface for developers. It contains beautiful and functional built-in components which are easy to customize. It also provides web based customization. And best of all it is an open source. What Bootstrap Package Includes? What Bootstrap Package Includes? Scaffolding: Bootstrap provides a basic structure with Grid System, link styles, background. This is is covered in detail in the section Bootstrap Basic Structure CSS: Bootstrap comes with feature of global CSS settings, fundamental HTML elements styled and enhanced with extensible classes, and an advanced grid system. This is covered in detail in the section Bootstrap with CSS. Components: Bootstrap contains over a dozen reusable components built to provide iconography , dropdowns, navigation, alerts, popovers, and much more. This is covered in detail in the section Layout Components. JavaScript Plugins: Bootstrap contains over a dozen custom jQuery plugins. Y ou can easily include them all, or one by one. This is covered in details in the section Bootstrap Plugins. Customize: You can customize Bootstrap's components, LESS variables, and jQuery plugins to get your very own version. Environment Setup Environment Setup It is very easy to setup and start using Bootstrap. This chapter will explain how to download and setup Bootstrap. It will also discuss the Bootstrap file structure, and demonstrate its usage with an example. Download Bootstrap Download Bootstrap You can download the latest version of Bootstrap from http://getbootstrap.com/. When you click on this link, you will get to see a screen as below: Bootstrap Quick Guide 11/4/2014 http://www.tutorialspoint.com/bootstrap/bootstrap_quick_guide.htm 1 / 27 Here you can see two buttons: Download Bootstrap: Clicking this, you can download the precompiled and minified versions of Bootstrap CSS, JavaScript, and fonts. No documentation or original source code files are included. Download Source: Clicking this, you can get the latest Bootstrap LESS and JavaScript source code directly from GitHub. If you work with Bootstrap's uncompiled source code, you need to compile the LESS files to produce usable CSS files. For compiling LESS files into CSS, Bootstrap officially supports only Recess , which is Twitter's CSS hinter based on less.js. For better understanding and ease of use, we shall use precompiled version of Bootstrap throughout the tutorial . As the files are complied and minified you don't have to bother every time including separate files for individual functionality. At the time of writing this tutorial the latest version (Bootstrap 3) was downloaded. File structure File structure PRECOMPILED BOOTSTRAP PRECOMPILED BOOTSTRAP Once the compiled version Bootstrap is downloaded, extract the ZIP file, and you will see the following file/directory structure: As you can see there are compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and JS (bootstrap.min.*). Fonts from Glyphicons are included, as is the optional Bootstrap theme. BOOTSTRAP SOURCE CODE BOOTSTRAP SOURCE CODE If you downloaded the Bootstrap source code then the file structure would be as follows: The files under less/, js/, and fonts/ are the source code for Bootstrap CSS, JS, and icon fonts (respectively). The dist/ folder includes everything listed in the precompiled download section above. docs-assets/, examples/, and all *.html files are Bootstrap documentation. HTML Template HTML Template A basic HTML template using Bootstrap would look like as this: <!DOCTYPE html> <html> <head> <title>Bootstrap 101 Template</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/ html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/ respond.min.js"></script> <![endif]--> </head> <body> <h1>Hello, world!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> Bootstrap Quick Guide 11/4/2014 http://www.tutorialspoint.com/bootstrap/bootstrap_quick_guide.htm 2 / 27 <script src="https://code.jquery.com/jquery.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html> Here you can see the jquery.js and bootstrap.min.js and bootstrap.min.css files are included to make a normal HTM file to Bootstrapped Template. More details about each of the elements in this above piece of code will be discussed in the chapter Bootstrap CSS Overview. This template structure is already included as part of the Try it tool. Hence in all the examples (in the following chapters) of this tutorial you shall only see the contents of the <body> element. Once you click on the Try it option available at the top right corner of example, you will see the entire code. Example Example Now let's try an example using the above template. Try following example using Try it option available at the top right corner of the below sample code box: <h1>Hello, world!</h1> Grid System Grid System What is a Grid? What is a Grid? As put by wikepedia: In graphic design, a grid is a structure (usually two-dimensional) made up of a series of intersecting straight (vertical, horizontal) lines used to structure content. It is widely used to design layout and content structure in print design. In web design, it is a very effective method to create a consistent layout rapidly and effectively using HTML and CSS. To put it simple words grids in web design organise and structure content, makes websites easy to scan and reduces cognitive load on users. What is Bootstrap Grid System? What is Bootstrap Grid System? As put by the official documentation of Bootstrap for grid system: Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts. Let us understand the above statement. Bootstrap 3 is mobile first in the sense that the code for Bootstrap now starts by targeting smaller screens like mobile devices,tablets, and then “expands” components and grids for larger screens such as laptops, desktops. MOBILE FIRST STRATEGY MOBILE FIRST STRATEGY Content Determine what is most important. Layout Design to smaller widths first. Base CSS address mobile device first;media queries address for tablet,desktops. Progressive Enhancement Add elements as screen size increases. Working of Bootstrap Grid System Working of Bootstrap Grid System Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here's how the Bootstrap grid system works: Rows must be placed within a .container class for proper alignment and padding. Use rows to create horizontal groups of columns. Content should be placed within columns, and only columns may be immediate children of rows. Predefined grid classes like .row and .col-xs-4 are available for quickly making grid layouts. LESS mixins can also be used for more semantic layouts. Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on .rows. Grid columns are created by specifying the number of twelve available columns you wish to span. For example, three equal columns would use three .col-xs-4. Media Queries Media Queries Media query is a really fancy term for "conditional CSS rule". It simply applies some CSS based on certain conditions set forth. If those conditions are met, the style is applied. Media Queries in Bootstrap allow you to move, show and hide content based on viewport size. Following media queries are used in LESS files to create the key breakpoints in the Bootstrap grid system. /* Extra small devices (phones, less than 768px) */ /* No media query since this is the default in Bootstrap */ /* Small devices (tablets, 768px and up) */ @media (min-width: @screen-sm-min) { ... } /* Medium devices (desktops, 992px and up) */ @media (min-width: @screen-md-min) { ... } /* Large devices (large desktops, 1200px and up) */ Bootstrap Quick Guide 11/4/2014 http://www.tutorialspoint.com/bootstrap/bootstrap_quick_guide.htm 3 / 27 @media (min-width: @screen-lg-min) { ... } Occasionally these are expanded to include a max-width to limit CSS to a narrower set of devices. @media (max-width: @screen-xs-max) { ... } @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { uploads/Ingenierie_Lourd/ bootstrap-quick-guide.pdf

  • 38
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager