float left floating elements with steps down to the right - html

I am trying to create thumbnails for images in a div to appear with three columns. These elements are in a form tag. when i try to float my images which are produced with a loop they are creating a step down to the right. I tried using grid css it still gives me the same result.
sample image
image
blade file
<form action="/p/update/{{ $post->id}}" enctype="multipart/form-data" method="POST">
<div class="form-group ">
#foreach($posts as $post)
<div id="carouselExampleControls" class="carousel slide" data-interval="false">
<div class="carousel-inner">
#for($i=0; $i< count($image=$post->images()->get()); $i++)
#if($i==0)
<div class=" ">
<div class="editImages ">
<div class="img-order"> <img class="posts-img crop" src="/images/{{$image[$i]['image']}}" alt="first slide"> </div>
<div class="bottom-right"> more images </div>
</div>
</div>
#else
<div class="">
<div class="editImages">
<div class="img-order"> <img class="posts-img crop" src="/images/{{$image[$i]['image']}}" alt="first slide"> </div>
<div class="bottom-right"> more images </div>
</div>
</div>
#endif
#endfor
</div>
</div>
#endforeach
</div>
</form>
css file
.form-group{
background:brown;
}
.editImages{
display:flex;
float: left;
border: 1px solid black;
}
.editImages > div > img {
width: 7rem;
height: 7rem;
}

idk if I got the question right but try to add this
.editImages{
vertical-align: top;
}

Related

How can I keep Bootstrap carousel inside a container?

I seem to be having difficulties with a bootstrap carousel it seems to "Break" outside of the container / row. I'm not 100% sure of what kind of information I may need to provide (First time posting here for help) But here is a screenshot followed by the code (Just a typical bootstrap carousel resized)
Screenshot of error
.project01-carousel {
width:640px;
height:360px;
}
<div class="col-sm-4">
<section class="project01-carousel halfheight">
<section class="project-carousel-wrap halfheight">
<!-- Carousel -->
<div class="project-carousel owl-carousel owl-nav-sticky-wide">
<div class="project-carousel-item project-01-carousel-item-01 halfheight
text-center">
<img src="admin/uploaded_image/terrain_renders/<?php echo $row['render1'];
?>">
</div>
<div class="project-carousel-item project-01-carousel-item-02 halfheight
text-center">
<img src="admin/uploaded_image/terrain_renders/<?php echo $row['render2'];
?>">
</div>
<div class="project-carousel-item project-01-carousel-item-03 halfheight
text-center">
<img src="admin/uploaded_image/terrain_renders/<?php echo $row['render3'];
?>">
</div>
<div class="project-carousel-item project-01-carousel-item-04 halfheight
text-center">
<img src="admin/uploaded_image/terrain_renders/<?php echo $row['render4'];
?>">
</div>
</div>
</section>
</section>
</div>
Make sure you don't have a static width for your content, and I notice you are using Owl Carousel in Bootstrap, so make sure you aren't duplicating any classes there/have Bootstrap carousel styles and js turned off so there's no conflicts.
Please note, I only used !important to overcome an img style that was overriding my 100% width call for it. You shouldn't have to use the !important tag in your code.
.project01-carousel {
/*width:640px;*/
width: 100%;
max-width: none;
height:auto;
border: 1px solid red;
}
img {
width: 100% !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="col-sm-4">
<section class="project01-carousel halfheight">
<section class="project-carousel-wrap halfheight">
<!-- Carousel -->
<div class="project-carousel owl-carousel owl-nav-sticky-wide">
<div class="project-carousel-item project-01-carousel-item-01 halfheight
text-center">
<img src="http://placehold.it/500x500">
</div>
<div class="project-carousel-item project-01-carousel-item-02 halfheight
text-center">
<img src="http://placehold.it/500x500">
</div>
<div class="project-carousel-item project-01-carousel-item-03 halfheight
text-center">
<img src="http://placehold.it/500x500">
</div>
<div class="project-carousel-item project-01-carousel-item-04 halfheight
text-center">
<img src="http://placehold.it/500x500">
</div>
</div>
</section>
</section>
</div>
First of all,you should wrap your
<div class="col-sm-4">
In a row and wrap the row in a container like this
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
And also you should remove the width for
roject01-carousel

Bootstrap carousel responsive img

I want to have the img in the carousel responsive. The height should be 100vh but the width needs to be as wide as it goes, depending on how big the img is. The overflowing part should be hidden. Now, when the screen gets smaller, the img is resized not to scale. Here's some screen shots
This is fine at full width, desktop version
This is about the witdh of tablets, but there are white space at the bottom which i dont want.
This is the phone version, resized but not to scale. It should also takes up the whole window, but the overflowing width can be hidden.
This is what I have for css:
.carousel,
.carousel-inner {
height: 100vh;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100vw;
height: 100vh;
max-width: none;
}
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive" src="photos/JO2_2978.JPG" alt="xmas_orchestra">
</div>
<div class="item">
<img src="photos/JO2_2875.JPG" alt="...">
</div>
<div class="item">
<img src="photos/IMG_1824.JPG" alt="...">
</div>
<div class="item">
<img src="photos/JO2_2955.JPG" alt="...">
</div>
<div class="item">
<img src="photos/IMG_3913.JPG" alt="...">
</div>
<div class="item">
<img src="photos/JO2_2957.JPG" alt="...">
</div>
</div> <!-- CAROUSEL-INNER -->
There is a better and a very simple way to do this.
Keep all your carousel code within the bootstrap column within a row(Grid system)
And give some class name like .carousel-column in my example and then do two things.
1.Set some height and width as per your wish in your custom css file.
2.And set img-responsive in your code in the mail HTML Page for carousel items.
It worked for me, hope it will work for all.
HTML CODE:
<!-- Carousel to highlight main services-->
<div class="row">
<div class="col-md-9 carousel-column">
<div id="myCarousel" class="carousel slide">
<!-- 1.Carousel Indicators-->
<ol class="carousel-indicators">
<li data-target="#myCarousel" class="active" data-
slideto="0</li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- 2.carousel Items (Picture plus data)-->
<div class="carousel-inner">
<div class="item active">
<img src="images/book2.jpg" class="img-responsive img-cus" >
<div class="container">
<div class="carousel-caption">
<h1>Web Development</h1>
<h3>Let's begin development.It really is about who you are and what you can do</h3>
<p><a class="btn btn-primary btn-large" href="signup.html">Sign Up</a></p>
</div>
</div>
</div>
<div class="item">
<img src="images/book.jpg" class="img-responsive img-cus">
<div class="container">
<div class="carousel-caption">
<h1>Twitter Bootstrap</h1>
<h3>A HTML,CSS,Javascript library for responsive
mobile first web development</h3>
<p><a class="btn btn-primary btn-large"
href="signup.html">Sign Up</a></p>
</div>
</div>
</div>
<div class="item">
<img src="images/coffee.jpg" class="img-responsive img-cus"
>
<div class="container">
<div class="carousel-caption">
<h1>Java Tutorials</h1>
<h3>A powerful secure server side object oriented
programming language</h3>
<p><a class="btn btn-primary btn-large"
href="signup.html">Sign Up</a></p>
</div>
</div>
</div>
</div>
<!-- Now We will create the carousel controls-->
<a href="#myCarousel" class="left carousel-control" data-
slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a href="#myCarousel" class="right carousel-control" data-
slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
</div>
Now do this in CSS file
CSS Styling:
.carousel-column{
height:500px;
width:900px;
margin:0 auto;
}
Try this:
Check Demo here
HTML:
<div class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="item active" style="background-image:url(http://dentistry.utah.edu/images/slider-banner/roy-hume.jpg); ">
</div>
<div class="item" style="background-image: url(http://dentistry.utah.edu/images/slider-banner/school-dentistry-students.jpg);">
</div>
</div>
<!-- CAROUSEL-INNER -->
</div>
CSS:
.carousel,
.carousel-inner {
height: 100vh;
}
.item {
border: 1px solid grey;
max-height: 100vh;
min-height: 100vh;
max-width: 100vw;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
if you are using img src="...", then use class="img-responsive" and in css width="100%".
it worked like that
<div class="carousel-item activo">
<a href="#" style="display: block; width: 100%; height: 100%;">
<img class="img-fluid d-block w-100" src="01.jpg" alt="Alternate Text" />
</a>
</div>
Need to change img css that please check
.carousel,
.carousel-inner {
height: 100vh;
}
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
height: auto;
max-width: 100%;
}
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive" src="photos/JO2_2978.JPG" alt="xmas_orchestra">
</div>
<div class="item">
<img src="photos/JO2_2875.JPG" alt="...">
</div>
<div class="item">
<img src="photos/IMG_1824.JPG" alt="...">
</div>
<div class="item">
<img src="photos/JO2_2955.JPG" alt="...">
</div>
<div class="item">
<img src="photos/IMG_3913.JPG" alt="...">
</div>
<div class="item">
<img src="photos/JO2_2957.JPG" alt="...">
</div>
</div> <!-- CAROUSEL-INNER -->
.carousel img {
position: absolute;
top: 0;
left: 0;
min-width: 100vw;
height: 100vh;
max-width: none;
object-fit:cover;
object-position:center;
}
Please replace you CSS code.

Multiple line Carousel Caption for Bootstrap

I've used the Carousel Container to create a Page Header with Text centred (horizontally & vertically), as it was the easiest way to centre text over an image - refer image.
My client wants me to add a horizontal line above & below the text, as its done in this image below, but im not sure on the best way to achieve this - given everything still needs to be centred & it has to be responsive.
Here is my HTML code (excluding Navbar, as its Bootstrap);
<div class="container">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<img src="images/community-group.jpg" alt="" class="center-block img-responsive" style="opacity: 0.8;">
<div class="carousel-caption">
<div class="text-center full-width"><h1>Contact Us </h1></div>
</div>
</div>
</div>
</div>
</div>
And here's the current CSS for handling the Carousel & Carousel Caption and making sure they're centred:
.full-width {
width: 100%;
}
h1 {
color: #ffffff;
font-size: 400%;
text-shadow: 2px 2px #9e9e9e;
}
.carousel-caption {
position: absolute;
top: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
height: 100%;
vertical-align: middle;
}
<div class="container">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<div class="carousel-caption">
<div class="row">
<div class="col-sm-4">
<div>
<div class="col-sm-4">
<div class="text-center full-width">
<hr/>
<h1>Contact Us </h1>
<hr/>
</div>
</div>
<div class="col-sm-4">
<div>
</div>
</div>
</div>
</div>
</div>
</div>
Simple Way:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<div class="carousel-caption">
<div class="row">
<div class="col-sm-4"><div>
<div class="col-sm-4">
<div class="text-center full-width">
<hr/>
<h1>Contact Us </h1>
<hr/>
</div>
</div>
<div class="col-sm-4"><div>
</div>
</div>
</div>
</div>
</div>
</div>
You can add an other class to carousel and change this carousel caption styles, whit this you have orginal carousel caption and your carousel caption.
Just change top to 50 percent and margin-top = caption height / 2
.verticalCarousel .carousel-caption {
bottom:inherit;
top: 50%;
margin-top:-150px;
border-top:1px solid #fff;
border-bottom:1px solid #fff;
}

How to make carousel with two pictures in computer display to 1 picture in mobile?

I want to make carousel with two pictures in row in computer display but only one picture in mobile view. This picture is at computer view that I want:
But it become as picture 2 when in mobile
I want to make it one and remove another 1. Display it one by one.
Below was HTML code and CSS. I'm using bootstrap too.
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div id="Carousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#Carousel" data-slide-to="0" class="active"></li>
<li data-target="#Carousel" data-slide-to="1"></li>
</ol>
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" style="max-width:100%;"></div>
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" alt="Image" style="max-width:100%;"></div>
</div><!--.row-->
</div><!--.item-->
<div class="item">
<div class="row">
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" alt="Image" style="max-width:100%;"></div>
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" style="max-width:100%;"></div>
</div><!--.row-->
</div><!--.item-->
</div><!--.carousel-inner-->
<a data-slide="prev" href="#Carousel" class="left carousel-control black-link">‹</a>
<a data-slide="next" href="#Carousel" class="right carousel-control black-link">›</a>
</div><!--.Carousel-->
</div> <!--.col-md-8-->
</div><!--.row-->
CSS:
.carousel {
margin-bottom: 0;
padding: 0 40px 30px 40px;
}
/* The controlsy */
.carousel-control {
left: -30px;
height: 0px;
width: 0px;
font-size: 153px;
background: none repeat scroll 0 0 #000000;
border: none;
border-radius: 20px 20px 20px 20px;
margin-top: 0px;
}
.carousel-control.right {
right: -12px;
}
.carousel-control.left {
left: -62px;
}
/* The indicators */
.carousel-indicators {
right: 50%;
top: auto;
bottom: -10px;
margin-right: -19px;
}
/* The colour of the indicators */
.carousel-indicators li {
background: #ffffff;
}
.carousel-indicators .active {
background: #1b365d;
}
your help is really appreciate.
There are many ways to solve this issue. Personally, I would use two completely different carousels and hide the one I'm not using with the standard bootstrap classes.
For example:
<div class='row'>
<!-- Large Carousel -->
<div class="hidden-xs">
... your carousel two picture version
</div>
<!-- Small Carousel -->
<div class="visible-xs">
... your carousel one picture
</div>
</div>
The reason I would do it this way is that it will give you the most control over how the two different carousels display. You'll be able to fix the two image problem and also easily adjust other styling issues. It will however lead to more lines of code.
You could alternatively do it within a single carousel using the same classes. From your example above:
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="hidden-xs">
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" alt="Image" style="max-width:100%;"></div>
<div class="col-md-6"><img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" style="max-width:100%;">
</div>
<div class='visible-xs'>
<div class="col-xs-12">
<img src="https://a2ua.com/picture/picture-002.jpg" class="img-responsive" alt="Image" alt="Image" style="max-width:100%;">
</div>
</div>
</div><!--.row-->
</div><!--.item-->
</div><!--.carousel-inner-->

Text inside bootstrap carousel active item aligned with and outside text

I have this code:
<section class="container">
Logo
</section>
<section class="col-xs-12">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="http://placehold.it/1500x400/888&text=Item 1" />
<div class="container">My intro</div>
</div>
</div>
</div>
</section>
It's a bootstrap carousel with only one item. The item is a picture and over the picture a text. Here is the jsfiddle code and here is the jsfiddle live example.
The thing is that i want to place the My intro text over the picture (with a margin top 10px) and in the same time to be aligned with the Logo text. How can i do this?
Solved it!
Make both text absolutely position like this jsfiddle
html
<div id="logo">Logo</div>
<section class="col-xs-12" class="slider">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="http://placehold.it/1500x400/888&text=Item 1" />
<div class="myintro">My intro</div>
</div>
</div>
</div>
</section>
css
.slider {
position:relative;
}
.myintro {
position:absolute;
bottom:10px;
left:10px;
z-index:100;
}
#logo {
margin-left:10px;
}
As anpsmn posted in the comment, seems like this answer was right and here it is:
HTML:
<section class="container">
Logo
</section>
<section class="col-xs-12">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="http://placehold.it/1500x400/888&text=Item 1" />
<div class="container test-over"><h2>My intro</h2></div>
</div>
</div>
</div>
</section>
CSS:
.test-over h2 {position: absolute; top: 10px;}
Jsfiddle here