Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Basics
by www.pluginvalley.com
1. What is Bootstrap?
2. Bootstrap for Joomla 3
3. Working with Bootstrap
4. Using Bootstrap Components
5. Create a Simple Site with Bootstrap
6. Bootstrap Buttons
7. Tabs with Bootstrap
8. Creating Dropdowns with Bootstrap
9. Tooltips
10. PopOver
11. Modals
12. Carousel Sliders
13. Bootstrap Collapse - Accordion
14. Using Labels and Badge
15. Creating Progress Bars with Bootstrap
What is Bootstrap?
Bootstrap is a free collection of tools for creating websites and web
applications. It is simply a sleek, intuitive, and powerful mobile first
front-end framework for faster and easier web development.
Explaining Bootstrap
Since the Bootstraps version 2.0 it also supports responsive design. That
means the layout of the web pages adjusts dynamically, taking into
account the characteristics of the device used (desktop, tablet, mobile
phone).
Bootstrap turns Joomla 3.0 mobile friendly both for visitors and
administrators; it is by and large the most common mobile framework.
Bootstrap is consistent; its uniform interface suits all extensions, thus
removing the need for multiple and different interfaces for the Joomla
admin area.
Bootstrap frees the developers from reinventing the basic interfaces and
takes the burden up on its own.
Bootstrap is a really tiny inclusion, but only when no independent
libraries are loaded. This ensures every component doesn’t load its own
thing but use the ones that came along.
Working with Bootstrap
Working with Bootstrap is not so difficult! As a first step you must prepare
your computer with a local server. You can simply download and install
XAMMP from Apache Friends Website or WAMP Server from Wamp Server
Website
After preparing your local host visit Bootstrap's GitHub Page and
Download the latest version of Bootstrap.
Now we are ready to start creating our first page with Bootstrap. Open
your favorite editor, e.g. Notepad++. However you desire, if you want
start to create a HTML document yourself from scratch or if you are not
sure which elemets you need to include, you can also start with a
Bootstrap Template from BootStap's website!
May be you are a bit confused, the master you downloaded has the source
code of the bootstrap too but the dist folder includes everything you need
as compiled. When we start a new project just move the folders css, js,
fonts from dist folder.
When you open these folders you will see the file structure as below.
dist/
├── css/
│ ├── bootstrap.css
│ ├── bootstrap.min.css
│ ├── bootstrap-theme.css
│ └── bootstrap-theme.min.css
├── js/
│ ├── bootstrap.js
│ └── bootstrap.min.js
└── fonts/
├── glyphicons-halflings-regular.eot
├── glyphicons-halflings-regular.svg
├── glyphicons-halflings-regular.ttf
└── glyphicons-halflings-regular.woff
You can visit via your browser the example pages of the Bootstrap you
have installed on your local server.
http://localhost/bootstrap/docs/examples/ Example Folder has sub-
folders below and you navigate and analyze the code and usage of the
code and resources.
• blog
• carousel
• cover
• dashboard
• equal-height-columns
• grid
• jumbotron-narrow
• jumbotron
• justified-nav
• navbar-fixed-top
• navbar-static-top
• navbar
• non-responsive
• offcanvas/
• rtl
• screenshots
• signin
• starter-template
• sticky-footer-navbar
• sticky-footer
• theme
• tooltip-viewport
Using Bootstrap
Components
Bootstrap Components are the elements that makes Bootstrap
Framework powerful, easy to use and popular in the web.
Simply a Bootstrap Component is Javascript Snippet that gives you the
advantage of creating web elements without writing any sing line of
jQuery Code. Bootstrap Components is a perfect advantage especially for
the sitebuilder who has no jQuery knowledge and for all of us to enhance
the turnover time.
Developers Note: For Simple Transition Effects, If you are including the
components one by one you must include transition.js once alongside the
other JS files. If you're using the compiled (or minified) bootstrap.js, you
do not need to include transition.js
01 Modal - js/modal.js:
Modals are streamlined, but flexible, dialog prompts with the minimum
required functionality and smart defaults.
02 Dropdown - js/dropdown.js:
You can easily add dropdown menus to nearly anything with modal.js
plugin, including the navbar, tabs, and pills.
03 Scrollspy - js/scrollspy.js:
Scrollspy is for automatically updating nav targets based on scroll
position.
04 Tab - js/tab.js:
With the tab.js you can add quick, dynamic tab functionality to transition
through panes of local content, even via dropdown menus.
06 Popover - js/popover.js:
When you want to show a secondary information as seen on iPad devices
and instead using the tooltips you can use popover to add small overlays
of content
07 Alert - js/alert.js:
You can add removable alerts by using alert.js
10 Carousel - js/button.js:
You can create carousels with sliders, navigational options, and many
more options for your carousel sliders.
11 Affix - js/affix.js:
You can use affix to show the current item at navigational menus.
Developers Note: you must provide CSS for the positioning of your
content when you are using affix.js
Create a Simple Site
with Bootstrap
Creating a Simple Site with Bootstrap is only a few steps. In this tutorial
we will see which files we need to move in our first bootstrap project and
how to link them.
In the previous tutorials we have learned the Workig with Bootstrap and
the File Structure. So we know basically which folders and the files we
need to use in our first project.
First of all we need to create a folder in our local host. I will call that
folder myfirstsite. After creating that folder i move from Bootstrap-
master which i downloaded from Get Bootstrap Site or the Bootstrap's
GitHub Page
After extracting the zipped file all i need is the folders and the files from
the dist folder.
localhost/
└── htdocs/
└─── myfirstsite/
├── js/
├── css/
├── fonts/
└── index.html
01 As a first step after creating the working folder and the index.html i
create the top of the document
As i define the document type and the html language at the top of the
index.html
!DOCTYPE html
html lang="en"
02 In the second step Create the head section and add the required Meta
Tags. character set, HTTP-EQUIV attribute defining control the action of
browsers. viewport meta tag with the content width=device-width and
initial-scale=1 will match the site layout width to the device width when
the document opened site layout at 1:1 scale.
charset="utf-8"
http-equiv="X-UA-Compatible" content="IE=edge"
name="viewport" content="width=device-width, initial-scale=1"
03 After this i add bootstrap's css file and 2 external files to help the site
work properly. After i close the head section and create the body at the
next step. You can view that part when you download the sample
index.html i created.
04 You can write to body section what ever you desire but just before
closing the body tag do not get to add latest compatible jQuery library
and the js/bootstrap.min.js which has all components compiled. We add
this 2 files at the end of the index.html files for a faster loading site.
Buttons are only used for actions while hyperlinks are to be used for the
objects. If you create a download button, "Download" should be a button
while "recent activity" should be a link.
Styles of the Buttons can be applied to anything by applying the class btn.
In the same time you can apply this class only to a and button elements.
For creating a button in your Bootstrap site all you need to do is adding
class="btn" to "button" or "a" elements. Below you can see a simple button
created by applyin btn class.
Styles
There are 5 Main Styles
01 Success Style: You need to apply class="btn btn-success"
02 Info Style: You need to apply class="btn btn-info"
03 Danger Style: You need to apply class="btn btn-danger"
04 Warning Style: You need to apply class="btn btn-warning"
05 Inverse Style: You need to apply class="btn btn-inverse"
We can also add transition through panes or we can simply add other
elements to the navigational section such dropdown menus. As we
mentioned since the beginning hence the required javascript comes with
bootstrap.min.js. After including js and css files all we need to do is
adding the correct markup for creating the tabs on our web pages.
We create two different sections, one for the tabs navigation and the
other one is for the container of the contents as we call Pane. We can
use the the code sample below and create navigational area of the tabs.
Lets create first the navigational section by the ul ve li elements
Now lets read the code; as you see we added nav and nav-tabs. These
are the required classes we add to ul element. And after we need to use
data attributes data-toggle at the a elements which inside the li
elements.
Another important point you need to care about the links is href
attributes are linked to pane's ( which will see just later )ids.
After completing the the navigational section now we create the panes.
Navigational tabs are linked to the panes and when we click the tabs
related pane becomes active. with different transition effects.
This is also quite easy to understand and create. First of all we create the
main container of the panes with the class tab-content and inside the
tab-content section we create the panes with the class tab-pane And
each tab-pane should carry the id name same as navigation li a
href="#SAME_WITH_PANE_ID
Creating Dropdowns
Creating Dropdodwns with Bootstrap is also very very easy. Again the most
important part is about understanding the mark-up well. We can create
navigational menus and dropdowns with similar syntax. Dropdowns can be
used in navigational bars or independent div areas.
We will again use the data attributes for creating the drop downs and
binding them to hidden menu. When we click to the visible menu item
which has data-toggle=dropdown javascript will add to the hidden menu
.open class and to the item we click adds the -backdrop. And when we
re-click to the same menu item javascript return the everrything to the
default.
<div class="dropdown">
<a data-toggle="dropdown" href="#"> Click Me to View the Links </a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li><a href="#">First Link</a></li>
<li><a href="#">Second Link</a></li>
<li role="presentation" class="divider"></li>
<li><a href="#">Third Link</a></li>
</ul></span>
</div></span>
Tooltips
Creating Tooltips with Bootstrap is very simple . You can create on any
html element, in any part of the content by adding only 3 attributes to
any text or image you desired.
For creating the tooltip you need to add following attributes to the html
element:
At that part i like to show you a basic sample and 1 tooltip on an image
with inside html. You can also create more complicated samples. It is
totally depended on your imagination.
When you want to use html in tooltip content you need to add 1 more
attibute: data-html="true"
You can see below a basic sample and 1 popover on an image with inside
html. You can also create more complicated samples. It is totally
depended on your imagination.
When you want to use html in tooltip content you need to add 1 more
attibute: data-html="true"
For an example, you want a modal window is opened when a user clicks
to a button, you must add to the button this 2 attributes defiitely. Firstly
fire the modal with attribute: data-toggle="modal" and then target
attribute, data-target="#your_modal_id".
Modal window you like to show must have a Dialog, Content, Header,
Body and the footer sections
You can analyze the code below and see how a modal window is
structured.
When you are creating the modals you must care of the
followings:
And please note that the transition animations for the Carousel sliders are
not supported in Internet Explorer 8 & 9
It is because the Bootstrap uses for the animations the CSS3 unfortunately
Internet Explorer 8 & 9 don't support the necessary CSS properties. Thus,
there are no slide transition animations when using these browsers and
the jQuery-based fallbacks for the transitions are not included in
Bootstrap.
You can also add optionally captions underneath the sliding elemens by
the following markup
And please note that you can also use the plugin without the accordion markup.
You can create a button toggle which expands and collaps of another element.
Bootstrap Collapse - Accordion Markup
Creating badges and the labels are not so difficult. All you need to do is
adding some new classes to the HTML of your bootstrap site.
You can check the samples below and see how to create labels and the
badges easily.
All you need to do is adding the class name: badge for the badges and the
class name: label for the labels.
For Creating Progress Bars all you need to do is adding some the area
with the class called progress and progress-bar classes to the HTML of
your bootstrap site.
You can add to your progress bars a label shows the completed
percentage or you can also customize progress bars by adding some of the
same button and alert classes for consistent styles.
You can also use Progress Bars as Striped, Animated, Stacked You can
check the samples below and see how to create Progress Bars with and
without labels easily.
<div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40"
aria-valuemin="0" aria-valuemax="100" style="width: 40%">
<span class="sr-only">40% Complete (success)</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20"
aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span class="sr-only">20% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-
valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
<span class="sr-only">60% Complete (warning)</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80"
aria-valuemin="0" aria-valuemax="100" style="width: 80%">
<span class="sr-only">80% Complete</span>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 35%">
<span class="sr-only">35% Complete (success)</span>
</div>
<div class="progress-bar progress-bar-warning" style="width: 20%">
<span class="sr-only">20% Complete (warning)</span>
</div>
<div class="progress-bar progress-bar-danger" style="width: 10%">
<span class="sr-only">10% Complete (danger)</span>
</div>
</div>
http://www.pluginvalley.com/tutorials/bootstrap-
tips-tutorials.html