Text inside bootstrap carousel active item aligned with and outside text - html

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

Related

float left floating elements with steps down to the right

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;
}

Container-Fluid in Mobile

I have a list like that:
I open a hidden div to show details about list items like that:
It's ok for large screen but in mobile info div goes so below. Is it possible to open info div as %100 (Container-Fluid) under that item in mobile like that:
If it's possible what is the keywords or can you show an example? Thanks in advance.
I have created a sample where you need to create two locations with the same div contents, one for mobile (.mobile-content) and one for desktop (.desktop-content).
The way you style it is when the mobile is visible, the desktop is hidden and vice versa. You can hide and show element using the Bootstraps 4 .d-x-none and .d-x-block.
The only thing left is you have to implement the click mechanism when you click on the circles......
Example (view this in full page):
.main-box {
text-align:center;
}
.circle{
flex-basis:33%;
}
.circle img{
background:pink;
border-radius: 50%;
max-width:100%;
}
.mobile-content{
flex-basis:100%;
}
.desktop-content{
text-align:center;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
<div class="main-box container-fluid d-flex justify-content-center flex-wrap flex-lg-nowrap">
<div class="circle px-2"><img src="https://dummyimage.com/200x200/4d204d/ffffff" /></div>
<div class="circle px-2"><img src="https://dummyimage.com/200x200/4d204d/ffffff" /></div>
<div class="circle px-2"><img src="https://dummyimage.com/200x200/4d204d/ffffff" /></div>
<div class="mobile-content p-2 d-lg-none">
<p>description comes here</p>
</div>
<div class="circle px-2"><img src="https://dummyimage.com/200x200/4d204d/ffffff" /></div>
<div class="circle px-2"><img src="https://dummyimage.com/200x200/4d204d/ffffff" /></div>
</div>
<div class="desktop-content p-4 d-none d-lg-block">
<p>description comes here</p>
</div>
In bootstrap 4, for equal columns in all devices try like this
<div class="row">
<div class="col">
1 of n
</div>
<div class="col">
1 of n
</div>
<div class="col">
1 of n
</div>
.....
<div class="col">
n of n
</div>
</div>
#circle {
width: 50px;
height: 50px;
background: red;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col" id="circle">
</div>
<div class="col" id="circle">
</div>
<div class="col" id="circle">
</div>
<div class="col" id="circle">
</div>
<div class="col" id="circle">
</div>
</div>

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

CSS img overflow my div

I have 3 div with height : 100vh
But with the responsive my imgs overflow. You can check that on the image.
Sorry for my poor english !
This is the html :
<section id="services" class="container content-section text-center">
<div class="col-lg-8 col-lg-offset-2">
<div class="row">
<div class="col-lg-6">
<h2>Services </h2>
<ul>
<li>Covoiturages </li>
<li>Food </li>
<li>Hébergement </li>
</ul>
</div>
<div class="col-lg-6">
<img src="img/mockup-iphone.png" alt="mockup iphone" class="img-responsive"/>
</div>
</div>
</section> <!-- close about -->
<section id="communities" class="container content-section text-center">
<div class="row">
<div class="col-lg-6">
<img src="img/mockup-iphone.png" alt="mockup iphone" class="img-responsive"/>
</div>
<div class="col-lg-6">
<h2>Communities </h2>
<ul>
<li>Texte </li>
<li>Texte </li>
<li>Texte </li>
</ul>
</div>
</div>
</section>
And the css :
#services{
width: 100%;
height:100vh;
background-color: #62b030;
}
#services img{
height:90%;
}
Try to smaller the img to height: 80vh, or calc image max-height: calc(100vh-100px); overflow:hidden for #services might work, too. YOu can also add width, adn height to your img-responsive or your img class.

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;
}