How to use Bootstrap grid system to div? - asp.net

I am designing the asp.net bootstrap form. I have one div in it.
Code:
<div id="gallery">
<a href="aboutus.aspx">
<img src="images/layout/exportsatdubai.jpg" class="img-responsive" width="900" title="" alt="" rel="a" />
</a>
<a href="http://expogr.com/" target="_blank">
<img src="images/layout/777x282-africa-1.jpg" class="img-responsive" width="900" title="" alt="" rel="a" />
</a>
<a href="addlisting.aspx">
<img src="images/layout/becomeAMember.jpg" class="img-responsive" width="900" title="" alt="" rel="a" />
</a><a href="dubaiexhibitions.aspx">
<img src="images/layout/dubaiexportersexhibitions.jpg" class="img-responsive" width="1000" title="" alt=""
rel="a" />
</a>
</div>
Css:
#gallery
{
position: relative;
height: 282px;
}
I wanted to make this div responsive using Bootstrap grid system. I am confused with div ie. How to apply grid system on div?
<div class="row">
<div class="col-sm-12">
<div class="gallery">
------contents------
</div>
</div>
</div>
Is it like this? I am new to Bootstrap. I just wanted to know how to apply grid system to div.

You can use the bootstrap grid like this.
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<a href="aboutus.aspx">
<img src="images/layout/exportsatdubai.jpg" class="img-responsive" alt="" rel="a" />
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<a href="http://expogr.com/" target="_blank">
<img src="images/layout/777x282-africa-1.jpg" class="img-responsive" alt="" rel="a" />
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<a href="addlisting.aspx">
<img src="images/layout/becomeAMember.jpg" class="img-responsive" alt="" rel="a" />
</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<a href="dubaiexhibitions.aspx">
<img src="images/layout/dubaiexportersexhibitions.jpg" class="img-responsive" alt="" rel="a" />
</a>
</div>
</div>
</div>
You can follow this link for further details. Bootstrap Grid

A general way to use grid system is
<div class="container">
<div class="row">
<div class="col-sm-3">Content1</div>
<div class="col-sm-3">Content2</div>
<div class="col-sm-3">Content3</div>
<div class="col-sm-3">Content4</div>
</div>
</div>
Every column will have equal width and it will act responsive. You don't need to set height or width of divs inside these columns unless you intentionally want it. If you can provide more details what exactly do you want , i can try to help more.

you can use the grid system of 12 spans and as many rows as you want as you have different spanning of images for different rows like this:
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-12"></div>
<a href="aboutus.aspx">
<img src="images/layout/exportsatdubai.jpg" class="img-responsive" alt=""/>
</a>
</div>
<div class="row">
<div class="col-xs-6 col-md-6">...</div>
<div class="col-xs-6 col-md-6">...</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6">...</div>
<div class="col-xs-6 col-md-6">.....</div>
</div>
.....
.....
and so on
</div>

Related

how to connect bootstrap template to sql table?

I want to create a asp.net website. I use a bootstrap template. I put the link of that here. https://shapebootstrap.net/demo/html/evento/index.html#event-carousel . I want to connect Event section to sqlserver and the pictures load from the database table. i test that with repeater and datalist control in asp.net but it does not work correctly and the style of template destroy.For example when I used the repeater the pictures load from database but all of them are in one column.
How can I do that? I create a new section like event section. but I want to connect it to sql server. I searched for it and understand that I should use 2 repeater like 2 for loop and use group by. For example the datatable that load from database has 12 rows. I should devide it for example into 4*3 and connect datatable to repeaters. I do not know how can I do it?
<section id="Prefer">
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-9">
<div id="Prefer-carousel" class="carousel slide" data-interval="false">
<h2 class="heading" style="text-align:right;">Prefer</h2>
<a class="even-control-left" href="#Prefer-carousel" data-slide="prev" ><i class="fa fa-angle-left" ></i></a>
<a class="even-control-right" href="#Prefer-carousel" data-slide="next"><i class="fa fa-angle-right"></i></a>
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event1.jpg" alt="event-image">
<h4>Chester Bennington</h4>
<h5>Vocal</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event2.jpg" alt="event-image">
<h4>Mike Shinoda</h4>
<h5>vocals, rhythm guitar</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event3.jpg" alt="event-image">
<h4>Rob Bourdon</h4>
<h5>drums</h5>
</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event1.jpg" alt="event-image">
<h4>Chester Bennington</h4>
<h5>Vocal</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event2.jpg" alt="event-image">
<h4>Mike Shinoda</h4>
<h5>vocals, rhythm guitar</h5>
</div>
</div>
<div class="col-sm-4">
<div class="single-event">
<img class="img-responsive" src="images/event/event3.jpg" alt="event-image">
<h4>Rob Bourdon</h4>
<h5>drums</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="guitar">
<img class="img-responsive" src="images/guitar.png" alt="guitar" />
</div>
</div>
</div>
</section><!--/#Prefer-->

How to specify the URL of a linked item in Semantic UI?

When using a "Link Item", begun with <div class="ui divided link items">, in Semantic UI (as per the manual: http://semantic-ui.com/views/item.html), where should I specify the URL of the page I would like the item to link to?
I tried wrapping the whole <div class="item"> within <a>, but doing so breaks the formatting of the item such that the content appears below the picture.
You can sub your div.item with a.item like in this fiddle or HTML below:
<div class="ui divided link items">
<a class="item" href="http://www.google.com" target="_blank">
<div class="ui tiny image">
<img src="http://www.semantic-ui.com/images/avatar/large/stevie.jpg">
</div>
<div class="content">
<div class="header">Google</div>
<div class="description">
<p></p>
</div>
</div>
</a>
<a class="item" href="http://www.yahoo.com" target="_blank">
<div class="ui tiny image">
<img src="http://www.semantic-ui.com/images/avatar/large/veronika.jpg">
</div>
<div class="content">
<div class="header">Yahoo!</div>
<div class="description">
<p></p>
</div>
</div>
</a>
<a class="item" href="http://duckduckgo.com/" target="_blank">
<div class="ui tiny image">
<img src="http://www.semantic-ui.com/images/avatar/large/jenny.jpg">
</div>
<div class="content">
<div class="header">DuckDuckGo</div>
<div class="description">
<p></p>
</div>
</div>
</a>
</div>

Photo gallery image margins

I'm trying to make a site for my new documentary and have found Bootstrap to be very helpful but I'm running into a bit of a problem:
I have 12 images, I'd like them to be arranged into 3 rows of 4, but make sure that with smaller screens this works out, so maybe on a mobile device it is only 1 image per column (or two).
Here is the site as is (no margins) http://athomewhileaway.org/gallery.html
Any ideas? Thanks...
Please try this one
HTML
<div class="row no-gutter">
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
<div class="col-md-3 col-sm-4 col-xs-6">
<img src="" alt="">
</div>
</div>
if you need one photo in small screen then you can remove col-xs-6 class from related div
CSS
.no-gutter > [class*='col-'] {
padding-right:0;
padding-left:0;
}
This CSS property needs to remove space between the columns (Twitter Bootstrap set gutter width in default).
Thanks!
Note the xs (extra small) and sm (small) You can use the .col-xs-6 (row of 2) or .col-xs-12 (single colum) for phones, and .col-sm-6/.col-sm-12 for tablet, up to 768px, I believe. If you provide a fiddle I will hook you up with a better solution. Learn more here.
On extra small devices (most phones):
<div class="container">
<div class="row">
<div class="col-xs-6">
#Your Stuff
</div>
<div class="col-xs-6">
#Your Stuff
</div>
</div>
</div>

Vertically align middle in Bootstrap column

In a Bootstrap carousel item, I have a row of images nested in Bootstrap columns. Their height varies according to the width of columns. In the same row, there are also carousel controls LEFT and RIGHT for changing the items of the carousel.
I need to have the controls left (<) and right (>) vertically centered to the row. How can this be acomplished?
I tried to remove the row class and use the dislay: table and table-cell, which aligned controls vertically, but whole responsiveness was lost.
Example here: http://testabc.borec.cz/
HTML (carousel):
<div id="monthly-tips" class="carousel slide showcase showcase-1 text-center"><!-- class of slide for animation -->
<h1>Title</h1>
<div class="carousel-inner">
<div class="item container-fluid active">
<div class="row" style="display: flex;
align-items: center;">
<div class="col-xs-1 nopadding">
<a class="carousel-control left" href="#monthly-tips" data-slide="prev">
<span class="gi gi-chevron-left"></span>
</a>
</div>
<div class="col-xs-10 col-sm-5 col-md-3">
<img src="./img/books/syn-spravce-sirotcince.jpg" class="envelope js-book1" alt="" />
</div>
<div class="hidden-xs col-sm-5 col-md-4">
<img src="./img/books/tanec-s-nepritelem.jpg" class="envelope js-book2" alt="" />
</div>
<div class="hidden-xs hidden-sm col-md-3">
<img src="./img/books/syn-spravce-sirotcince.jpg" class="envelope js-book1" alt="" />
</div>
<div class="col-xs-1 nopadding">
<a class="carousel-control right" href="#monthly-tips" data-slide="next">
<span class="gi gi-chevron-right"></span>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-1 nopadding"></div>
<div class="col-xs-10 col-sm-5 col-md-3">
<span class="bottom-shadow"></span>
</div>
<div class="hidden-xs col-sm-5 col-md-4">
<span class="bottom-shadow"></span>
</div>
<div class="hidden-xs hidden-sm col-md-3">
<span class="bottom-shadow"></span>
</div>
<div class="col-xs-1 nopadding"></div>
</div>
<div class="row info-holder">
<div class="col-xs-1 nopadding"></div>
<div class="col-xs-10 col-sm-5 col-md-3">
<p class="book-title">Syn správce sirotčince</p>
<p class="book-author">Adam Johnson</p>
</div>
<div class="hidden-xs col-sm-5 col-md-4">
<p class="book-title">Tanec s nepřítelem</p>
<p class="book-author">Ruta Sepetysová</p>
</div>
<div class="hidden-xs hidden-sm col-md-3">
<p class="book-title">Tanec s nepřítelem</p>
<p class="book-author">Ruta Sepetysová</p>
</div>
<div class="col-xs-1 nopadding"></div>
</div>
</div>
<div class="item">
<img src="http://placehold.it/1200x480" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
</div>
</div><!-- carousel monthly-tips -->
You can add a new css property align-items on your .row container like this :
CSS :
.row { // add a new class to your row and target your newest class
display: flex;
align-items: center;
}

Arrows/images between bootstrap columns

I have 3 images within a row. Between each column, i'd like to add an arrow pointing to the next image.
How can I do this, while keep the existing images centered (so the middle one is in the middle of the page), and so it degrades nicely on smaller screens (disappears for instance)?
html:
<html>
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<h1 class="col-sm-12" style="text-align: center;">EASY TO USE</h1>
<hr>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-3">
<img class="img" src="../assets/img/indevice/step1htc.mini.24.png" height="350px" width="240px" alt="">
</div>
<div class="img col-sm-1"><img class="img" src="../assets/img/arrow.png" alt=""></div>
<div class="col-sm-3">
<img class="img" src="../assets/img/indevice/step2htc.mini.24.png" height="350px" width="240px" alt="">
</div>
<div class="img col-sm-1"><img class="img" src="../assets//img/arrow.png" alt=""></div>
<div class="col-sm-3">
<img class="img" src="../assets/img/indevice/step3htc.mini.24.png" height="350px" width="240px" alt="">
</div>
</div>
</div>
</body>
</html>
EDIT: For clarification, I want to add arrows between the existing images in the html code above. The html/css above is already centered. Howver, i'd like to add 2 arrows between the 3 existing images.
EDIT: Please see this image to understand what I mean: http://imgur.com/YT2hnw4
EDIT: Changed html to show a full example, including css call.
Here you go
<div class="container">
<div class="row">
<h1 class="centered" style="text-align: center;">EASY TO USE</h1>
<hr>
<div class="col-md-3" style="margin-left:4.17%;">
<img class="img" src="image" height="350px" width="240px" alt="">
</div>
<div class="img col-md-1">
<img class="img" src="../assets/img/arrow.png" alt="">
</div>
<div class="col-md-3">
<img class="img" src="image" height="350px" width="240px" alt="">
</div>
<div class="img col-md-1">
<img class="img" src="../assets//img/arrow.png" alt="">
</div>
<div class="col-md-3">
<img class="img" src="image" height="350px" width="240px" alt="">
</div>
</div>
</div>
All i did is removed the extra col-md-1 class and instead added the margin of the same equivalance to the 1st element so that it stay in the center.

Resources