Images overlap when I use bootstrap which I don't want - javascript

This code is a part of the website which i am making and this section keeps overlapping images. How do I correct this?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container-fluid" style="background-color:white; height:700px;">
<div class="row">
<div class="col-md-6">
<img src="images/team/app2.jpg" style="height:180px;width:180px;">
</div>
<div class="col-md-6">
<img src="images/team/website.png" style="height:180px;width:180px;">
</div>
<div class="col-md-4">
<img src="images/team/designer1.jpg" style="height:180px;width:180px;">
</div>
<div class="col-md-4">
<img src="images/team/content.png" style="height:180px;width:180px;">
</div>
<div class="col-md-4">
<img src="images/team/marketing2.jpg" style="height:180px;width:180px;">
</div>
</div>
</div>
Image of the same:

Because you set image to be always 180x180 if the width will be lower than 540 (+some margins) they will overlap. You can disable it by setting overflow: hidden; on each column. But in your case this should not appear as you are using md columns.
So I think your problem is that you have too much columns. There should be next row each time you exceed row column limit in bootstrap default is 12.
<div class="container-fluid" style="background-color:white; height:700px;">
<div class="row">
<div class="col-md-6">
<img src="images/team/app2.jpg" style="height:180px;width:180px;">
</div>
<div class="col-md-6">
<img src="images/team/website.png" style="height:180px;width:180px;">
</div>
</div>
<div class="row">
<div class="col-md-4">
<img src="images/team/designer1.jpg" style="height:180px;width:180px;">
</div>
<div class="col-md-4">
<img src="images/team/content.png" style="height:180px;width:180px;">
</div>
<div class="col-md-4">
<img src="images/team/marketing2.jpg" style="height:180px;width:180px;">
</div>
</div>
</div>

Make sure your css of the images is position: static;
If you want them in-line with one and other, add: display: inline-block; or if you want it just downwards: display: block;
Refer to positioning: https://developer.mozilla.org/en-US/docs/Web/CSS/position

Related

How can i apply ordered list number to each row dynamically to bootstrap rows

I am using bootstrap grid system and wanted to add prefix number to each row which will basically shows the number to each row. list 1, 2, 3, 4. How can I achieve that?
Desired output:
1. content will appear here
2. content will appear here
3. content will appear here
4. content will appear here
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
</div>
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles/Using_CSS_counters
.container.counter {
counter-reset: section;
}
.container.counter .row {
counter-increment: section;
}
.container.counter .col::before {
content: counter(section) ".";
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="container counter">
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
<div class="row">
<div class="col">
content will appear here
</div>
</div>
</div>

How to use push pull in bootstrap 5?

I want to use a push, pull in Bootstrap v5.0.0-beta2, but how?
In Bootstrap 3, I'm using it like this:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-9 col-md-push-3">.col-md-9 .col-md-push-3</div>
<div class="col-md-3 col-md-pull-9">.col-md-3 .col-md-pull-9</div>
</div>
I tried. But I can't. Here is my JSFiddle
In Bootstrap V5, how can I use push and pull?
Please help.
Thanks in advance.
Push/pull is a grid technique. That's now deprecated in favour of flex.
For flex the helper classes are .order-. See BS5 Columns documentation.
You can use global ordering:
<div class="container">
<div class="row">
<div class="col">
First in DOM, no order applied
</div>
<div class="col order-5">
Second in DOM, with a larger order
</div>
<div class="col order-1">
Third in DOM, with an order of 1
</div>
</div>
</div>
Or screen size specific ... i.e. .order-sm-*, .order-lg-*, and so on.
If you just want to shift, then use Offsetting Columns
<div class="container">
<div class="row">
<div class="col-md-4">.col-md-4</div>
<div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
</div>
<div class="row">
<div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
<div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
</div>
<div class="row">
<div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
</div>
</div>
EDIT:
In your case you can use:
<div class="row">
<div class="col-md-9 order-last">.col-md-9 <del>.col-md-push-3</del><ins>order-last</ins></div>
<div class="col-md-3 order-first">.col-md-3 <del>.col-md-pull-9</del><ins>order-first</ins></div>
</div>
or:
<div class="row">
<div class="col-md-9 order-2">.col-md-9 <del>.col-md-push-3</del><ins>order-2</ins></div>
<div class="col-md-3 order-1">.col-md-3 <del>.col-md-pull-9</del><ins>order-1</ins></div>
</div>

Bootstrap responsive gallery with match height for images

Im trying and trying too build something i think simple but right know i dont know how to do it ;) Honestly i mad it few months ago but i lost files and i don have any idea how to build it right now
So, im using Bootstrap to build gallery i have 2 different sizes of images long and short ones
Long ones are 1920x1200, short 1200x1200px
im trying to build it in grid like
<div class="row">
<div class="col-md-6">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
<div class="col-md-6">
<img src="yourImg" />
</div>
<div class="col-md-6">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
<div class="col-md-3">
<img src="yourImg" />
</div>
</div>
Of course it should look like in my preview img
and of course img should be in the center of each column.
I tried to use JS for match heigh and it works fine but of course image is out of the parent div and i cant fix it. I cant use background-image beacuse JS is not reading the size of div.
Any ideas ? How to build it ? The best thing is that i build it ...... and right now i can build it again !
Thank you very very much !
If you want the image to match the containing div's size you should add this code to the CSS:
img {
max-width: 100%;
max-height: 100%;
}
you can also save the original ratio by using this instead:
img {
max-width: 100%;
height: auto;
}
First of all, the structure of the html is wrong,
each row has 12 columns, you have put all the columns of each row into one row.
The code should be like this:
<div class="row">
<div class="col-md-6">
<img>
</div>
<div class="col-md-3">
<img>
</div>
<div class="col-md-3">
<img>
</div>
</div>
<div class="row">
<div class="col-md-6">
<img>
</div>
<div class="col-md-6">
<img>
</div>
</div>
<div class="row">
<div class="col-md-3">
<img>
</div>
<div class="col-md-3">
<img>
</div>
<div class="col-md-3">
<img>
</div>
<div class="col-md-3">
<img>
</div>
</div>
Like this, the images should be organized more or less as you want

Bootstrap Affix Not Moving

I'm trying to make the navigation sidebar on my website move down with the browser view via Bootstrap's Affix plugin however it refuses to follow the view and just stays at the top.
This is the structure I have for my HTML:
<div id="page-wrapper">
<div class="container">
<div class="row">
<div id="navigation-affix" data-spy="affix" data-offset-top="20" data-offset-bottom="200">
<div class="col-xs-2" id="navigation-wrapper">
<div class="inner">
<div class="row">
<div class="col-xs-12">
<img src="images/me.png" alt="Liam Potter" id="picture-me" class="img-responsive">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div id="navigation">
Home
Portfolio
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-10" id="content-wrapper">
<div class="inner">
</div>
</div>
</div>
</div>
<div id="page-push"></div>
</div>
<footer>
<div class="container">
</div>
</footer>
Source: https://jsfiddle.net/tbejd5en/1/
Any thoughts?
You can just add a position:fixed to your id #navigation-affix and add col-xs-offset-2 to your id #content-wrapper
div#navigation-affix {
position: fixed !important;
}
Here is fiddle: https://jsfiddle.net/tbejd5en/5/
You can just add a position:fixed to your id #navigation
HTML
<div class="row">
<div class="col-xs-12">
<div id="navigation">
Home
Portfolio
</div>
</div>
</div>
CSS
div#navigation {
text-align: right;
padding-top: 10px;
position: fixed;
}
DEMO
https://jsfiddle.net/tbejd5en/2/

Adjust position of panels in bootstrap

I am told to make a shopping cart website using bootstrap with the images of products positioned in two rows and with three panels in each row
Although here i have coded for only one panel with the image within it,the main problem that I am facing is to adjust the position of panel which is always appearing on the top of the page.
I tried to enclose it in a div with id posi and then tried to position it using but it didn't work so please help.Further the image is appearing too big so what is the best method to re-size it so that the image responsiveness remains intact.I also have another question which is written in my code snippet(as a comment) if anybody knows the answer of that kindly help.
<!DOCTYPE HTML>
<html>
<head>
<title>
Web page
</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<style>
#posi
{
position=absolute;
top=100px;
right=50px;
}
</style>
</head>
<body>
<div id="posi">
<div class="container">
<div class="row" >
<div class="col-md-3 col-md-6" ><!--Although I have used this col-md-3 col-md-6 but I also want to know
what happens when we specify two column definitions in a single class like this-->
<div class="panel panel-default" >
<div class="panel-heading panel-primary">
Iphone 6
</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923" class="img-responsive" />
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
You need to set the position for top to take effect.
body,
html {
background: grey;
}
#wrapper {
top: 100px;
right: 50px;
position: absolute;
background: lightblue;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div id="wrapper">
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading panel-primary">Iphone 6</div>
<div class="panel-body">
<img src="http://store.storeimages.cdn-apple.com/4711/as-images.apple.com/is/image/AppleInc/aos/published/images/i/ph/iphone6/plus/iphone6-plus-box-gold-2014?wid=478&hei=595&fmt=jpeg&qlt=95&op_sharpen=0&resMode=bicub&op_usm=0.5,0.5,0,0&iccEmbed=0&layer=comp&.v=1411520675923"
class="img-responsive" />
</div>
</div>
</div>
</div>
</div>
</div>

Categories

Resources