[ad_1]
https://i.ytimg.com/vi/lAh2uPzoGyg/hqdefault.jpg
how to use bootstrap grid classes
bootstrap 3 column classes
bootstrap grid system classes
bootstrap’s predefined grid classes
twitter bootstrap grid classes
twitter bootstrap column classes
col-sm-6 col-md-4 col-lg-2
In this video we will discuss Bootstrap 3 grid classes and their use.
Grid classes for a given screen size apply to that screen size and larger unless another declaration overrides it. Let us understand what we mean by this statement with an example.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1
For example, we want four equal columns on both medium and large devices.
For medium devices the class that we use is col-md-*. Since we want 4 equal columns, we would use four col-md-4 columns as shown below. So with the following HTML we get four equal columns on both medium and large devices. This is because col-md-* class is applied to both medum and large deives as we have not used col-lg-*.
[div class=”container”]
[div class=”row”]
[div class=”col-md-3″]
[div class=”customDiv”]Column 1[/div]
[/div]
[div class=”col-md-3″]
[div class=”customDiv”]Column 2[/div]
[/div]
[div class=”col-md-3″]
[div class=”customDiv”]Column 3[/div]
[/div]
[div class=”col-md-3″]
[div class=”customDiv”]Column 4[/div]
[/div]
[/div]
[/div]
If you want, you can change this on a large device by using col-lg-* class along with col-md-* class. Let us say on a large deive we want just 2 columns in every row with 3:1 ratio.
// bootstrap 3 grid classes example.png
To achieve this we would modify our HTML as shown below. So with these 2 classes in places we get 4 equal columns on a medium device and 2 columns with 3:1 ratio on a large device.
[div class=”container”]
[div class=”row”]
[div class=”col-md-3 col-lg-9″]
[div class=”customDiv”]Column 1[/div]
[/div]
[div class=”col-md-3 col-lg-3″]
[div class=”customDiv”]Column 2[/div]
[/div]
[div class=”col-md-3 col-lg-9″]
[div class=”customDiv”]Column 3[/div]
[/div]
[div class=”col-md-3 col-lg-3″]
[div class=”customDiv”]Column 4[/div]
[/div]
[/div]
[/div]
However, on a small device notice the columns are stacked on top of each other with each column spanning across the 12 column grid system. If you want you can change this default behaviour using col-sm-* class. Let us say on a small device we want 2 equal columns in every row.
// bootstrap 3 column classes example.png
To achieve this we would modify our HTML as shown below. So with these 3 classes in places we get 4 equal columns on a medium device, 2 columns with 3:1 ratio on a large device and 2 equal columns on a small device.
[div class=”container”]
[div class=”row”]
[div class=”col-md-3 col-lg-9 col-sm-6″]
[div class=”customDiv”]Column 1[/div]
[/div]
[div class=”col-md-3 col-lg-3 col-sm-6″]
[div class=”customDiv”]Column 2[/div]
[/div]
[div class=”col-md-3 col-lg-9 col-sm-6″]
[div class=”customDiv”]Column 3[/div]
[/div]
[div class=”col-md-3 col-lg-3 col-sm-6″]
[div class=”customDiv”]Column 4[/div]
[/div]
[/div]
[/div]
On an extra small device, the columns are stacked on top of each other with each column spanning across the 12 column grid system. If you want you can change this default behaviour very easily using col-xs-* class.
Now, if you remove all the grid classes except col-sm-6. In other words if we modify the code as shown below, we get 2 eqaul columns on small, medium and large devices. This is because grid classes for a given screen size apply to that screen size and larger unless another declaration overrides it.
[div class=”container”]
[div class=”row”]
[div class=”col-sm-6″]
[div class=”customDiv”]Column 1[/div]
[/div]
[div class=”col-sm-6″]
[div class=”customDiv”]Column 2[/div]
[/div]
[div class=”col-sm-6″]
[div class=”customDiv”]Column 3[/div]
[/div]
[div class=”col-sm-6″]
[div class=”customDiv”]Column 4[/div]
[/div]
[/div]
[/div]
By now I believe you have understood the use of these grid classes. With these classes, you have complete control over the layout of your website on different screen sizes.
Link for all dot net and sql server video tutorial playlists
https://www.youtube.com/user/kudvenkat/playlists?sort=dd&view=1
Link for slides, code samples and text version of the video
http://csharp-video-tutorials.blogspot.com/2016/05/bootstrap-3-grid-classes_17.html
Original source
36 responses to “Bootstrap 3 grid classes”
thank you, sir
venkat it's time to start series programming android applications
Thank you sir ,this tutorial is very helpful .
Awesome explantion!! ๐
The way of explaining is very clear and easy to understand. I really recommend this Kudvenkat
i love your videos watching in may 2020
Excellent way of explaining. Very helpful tutorial.
Thank you so much!
Hi sir watched gridview classes video when I run it output displaying in the form of row not column why so please reply back
Thank you for a great explanation!
8:24 summary
Thank you Sir! Always enjoyed your video!
Your explanation is very nice sir!
Sir you are amazing this video clear my all doubts thank u so so so much.
what a clear explanation is it!!! thank you very much.
Hi sir
Can you please tell me how we divide a row into 5 equal columns
its very helpful to new learner .Thanks
Thank you. God bless you
Hello Sir,
I am using the Eclipse as IDE and created the "Internet_access " as the dynamic web project . I am using the CDN version of the bootstrap and created the css file with name "CustomStyles.css" and I am trying to refer it in my html file using the query
<link rel="stylesheet" href="/Internet_access/CustomStyles.css" type="text/css">
But the CSS effects are not applied.Why is it so?
Sir, I have a question there are 12 columns in BS Grid, you are making it 9+3+9+3 for large? is this right i am bit confused
What a nice explanation sir…thankyou so much
Best tutorial with best explanation
thank you sir for making the thing more easier to learn.please keep posting
Excellent Series. ๐๐๐
Sir i want alaways same column in medium and large device and only 2 columns in small device how can we are do this??
magnificent clarification …. Best youtuber ever
thank you very much for informative lessons and concise explanations ๐
But sir what is need of overriding if it can shift its layout accordingly
How do you make the columns use 100% of the height?
tanks sir amazing explanations
this channel rocks.
best programming channel ever
One page can contain only one container can write ? or multiple ?
Very Good
very good tutorial
many thanks
https://www.youtube.com/watch?v=6-X5a339_7U&t=8s