Image positioned over container div limit - css

For better understanding I'm updating the entire question.
I'm using bootstrap 3 and the carousel component, however, one of the pages of the carousel contains an image that needs to be positioned in the bottom of the section tag without resizing the container.
Here is the code I'm using:
<section id="header-slider" class="section carousel slide" data-ride="carousel" style="padding-bottom: 0;">
<!-- Start Slider Navigation -->
<ol class="carousel-indicators">
<li class="active" data-slide-to="0" data-target="#header-slider"></li>
<li data-slide-to="1" data-target="#header-slider" class=""></li>
</ol>
<!-- End Slider Navigation -->
<div class="carousel-inner">
<div class="item row active">
<div class="col-xs-5 hidden-sm">
<img src="..." style="margin-top: -40px">
</div>
<div class="col-xs-7">
<h1>...</h1>
<p>...</p>
</div>
</div>
<div class="item row">
<div class="col-xs-8">
<h1>...</h1>
<p>...</p>
</div>
</div>
</div>
</section>
Here is a running page with the problem: www.remotepark.com.br
You may see that after transitioning to the second page on carousel component, it is resized.
How can I fix this keeping the height of the pages equal (actually all pages need to have the same height as page 2)?

Not sure if I completely understood..
but maybe give this a try and see if it accomplishes what you're aiming for.
<div style="width: 400px; height: 250px; position: relative;">
<div style="width: 400px; height: 150px">
<img src="..." style="width: 200px; height: 200px; position: absolute; bottom: 0;" />
</div>
</div>

Try changing your style.css from
.carousel .item {
padding-top: 50px;
height: 300px;
}
to:
.carousel .item {
height: 290px; /* the image height */
}
also remove:
style="margin-top: -40px" from the image in the first carousel item

Related

positioning two images in an overlay format

I have two images that I need to be layered side-by-side.
This is what image 1 looks like now, utilizing the following code:
<section id="4" class="pt-sm-3 pt-md-5 pb-2">
<div class="row text-center">
<div class="col-md-1">
</div>
<div class="col-md-3">
<img class="lazyload img-responsive product-images"
style="max-width: 100%; height: auto; margin: 0 auto;"
data-src="#Url.Content("./redImage.png")"
src="#Url.Content("~/Themes/21Rocs/Content/Images/loading(2).gif")" />
</div>
<div class="col-md-3">
<img class="lazyload img-responsive product-images"
style="max-width: 100%; height: auto; margin: 0 auto;"
data-src="#Url.Content("./blueImage.png")"
src="#Url.Content("~/Themes/21Rocs/Content/Images/loading(2).gif")" />
</div>
</div>
</section>
I would like to have the images overlay on top of each other like the following:
How would I go about setting that up in CSS? I tried to use this approach but can't get the layer to fit properly. Please help. Thank You!
You should use negative margins to make these thing
I set a class to col-md-3 called overlay and i styled this on style.css
Hope this works
.overlay {
margin-right: -100px;
}
<link rel = "stylesheet" href="style.css">
<section id="4" class="pt-sm-3 pt-md-5 pb-2">
<div class="row text-center">
<div class="col-md-1">
</div>
<div class="col-md-3 overlay">
<img class="lazyload img-responsive product-images"
style="max-width: 100%; height: auto; ;"
data-src="#Url.Content("./redImage.png")"
src="https://wallpapercave.com/wp/wp3260204.jpg" />
</div>
<div class="col-md-3">
<img class="lazyload img-responsive product-images"
style="max-width: 100%; height: auto; ;"
data-src="#Url.Content("./blueImage.png")"
src="https://cdn.wallpapersafari.com/44/96/ow6U0D.jpeg" />
</div>
</div>
</section>
</section>
Something like adding position: relative; transform: translateX(-50px) translateY(-50px); z-index: -1; as styling to the second image could be a quick fix. (You would probably need to amend the translateX/translateY values to get them where you need them - no other elements on the page will be affected by this transform)

How to make bootstrap corousal responsive

I am making bootstrap corousal of full width and height,The height is responsive but the width is not responsive (i.e) when i resize the window the image starts crop according to the width of the viewport,when it reaches to mobile screen size the left part the corousal crops,Below is the Bootstrap and css code,Can anyone help hoe to make image width responsive,Thanks
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for Slides -->
<div class="carousel-inner">
<div class="item active">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/corousal1.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/corousal2.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/corousal1jpg.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/corousal4.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
<div class="drbatras-logo">
<img src="images/logo.png" alt="logo"/>
</div>
</header>
CSS
html,
body {
height: 100%;
}
.carousel,
.item,
.active {
height: 100%;
position: relative;
}
.carousel-inner {
height: 100%;
}
/* Background images are set within the HTML using inline CSS, not here */
.drbatras-logo{
position: absolute;
top:60px;
right: 170px;
}
.fill {
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
you can use <img> tag and set class="img-responsive"
<img class="img-responsive" src="img_chania.jpg" alt="Chania" width="460" height="345">
you can use this
<div class="fill" id="fill"> </div>
css
#fill{
background:url('images/corousal1.jpg') no-repeat center center;
background-size:100% auto;
}

set height div to other element height on page

I've created this content with drupal. Below the image you have a next page button.
I also set a button for next image on top of the image (pager) so if the visitor clicks on the image it would go next page.
How can i stretch the link over my image, drupal generated 2 divs and the images are variable in height.
<div class="view-content">
<div class="container12">
<div class="pagerfoto column12">
<h2 class="element-invisible">Pagina's</h2>
<div class="item-list">
<ul class="pager">
<li class="pager-next first">
›
</li>
<li class="pager-last last">
</ul>
</div>
</div>
</div>
<div class="container12">
<ul>
<li class="views-row views-row-1 column12">
<div>
<div class="views-field views-field-field-image">
<div class="field-content">
<img width="900" height="675" alt="" src="http://www.logicaarchitectuur.be/test/sites/default/files/styles/gallery_large/public/desert.jpg?itok=J6D4TAEL" typeof="foaf:Image">
</div>
</div>
</li>
</ul>
</div>
site
.pagerfoto{
z-index:1;
position:absolute;
padding-top:1.71429em;
display:block;
}
.pagerfoto ul li.pager-next a{
display:block;
margin:0 auto;
padding:0;
text-indent: -9999px;
}
This is the current css i use for ma a label.
Try giving this css:
.view-project11 {
position: relative;
}
.item-list {
left: 50%;
position: absolute;
top: 50%;
}
If I understand your question correctly you would like the user to click on the image and then the page will go to the next image.
wrapping your image in the tag will allow you to do that.
example
<a width="900" height="675" href="/test/project11?page=1">
<img width="900" height="675" alt="" src="http://www.logicaarchitectuur.be/test/sites/default/files/styles/gallery_large/public/desert.jpg?itok=J6D4TAEL" typeof="foaf:Image">
</a>

Issue on Ordering Thumbnails in bootstrap 3

Hi I am trying to create simple slider for displaying latest product on the page using Bootstrap 3 at This DEMO. I have 6 thumbnails in a gallery div which I would like to display only 4 of them in front view and slide to left to see two more. I used bootstrap
<ul class="list-inline">
<li>...</li>
</ul>
css to render a display: inline-block; list of my <li>s but I do not know why they are not fitting in one line and 2 last items displays at the buttom of the gallery box. BESIDES the first <li> looks taller (Even if I have only 4 <li>).
Now my questions are:
1 - Why The First item Looks taller than the rest?
2 - Why Items are not displaying in a line?
3 - Finally why the overflow: hidden; property in .gallery is not performing properly?
and here is my code:
.gallery {
margin: 0 auto;
overflow: hidden;
width: 100%;
position: relative;
max-height:325px;
}
<!-- About Section -->
<section id="ft" class="cbp-so-section cbp-so-init">
<div class="container cbp-so-side cbp-so-side-top">
<h4>Latest Features</h4>
<div class="row">
<div class="well gallery col-lg-12 col-md-12 col-sm-2 col-xm-1">
<ul class="list-inline">
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
<li class="col-sm-3">
<div class="well"><img src="http://placehold.it/500x500" alt="Image" class="img-responsive"></div>
</li>
</ul>
</div>
</div>
</div>
</section>
Playing a bit with Firebug, I found that the issue here is because of the following rule:
.list-inline > li:first-child {
padding-left: 0;
}
All the .list-inline > li elements have a padding-left:5px rule, expect the first child. Because of that missing padding in the first child, the img inside has 5px more width (because of the max-width:100%; rule).
If you set the width of the img in pixels, you will not have this issue.
Regarding the (2) question, the bootstrap grid system requires that in one row the number sum of the col-sm-* is 12. You need to change in from col-sm-3 to col-sm-2 to have all 6 items in one line.
Regarding the (3) question, I am not sure what exactly you are expecting to see.
EDIT 2: See this link for a CSS fix http://bootply.com/111878
.gallery {
margin: 0 auto;
overflow: hidden;
width: 100%;
position: relative;
max-height:310px;
}
.list-inline img.img-responsive {
height: 233px;
width: 233px;
}

the <a> tag in my carousel is showing dead link in bootstrap

the anchor tag in my carousel is showing dead link. i.e. cannot hover over it. everything else works fine. but the link is not working inside the div. i have used all the files from bootstrap and have not made any changes to the scripts.
HTML:
<div class="carousel-inner">
<div class="item active">
<div class="fill" style="background-image:url('images/slide1.jpg'); background-size:cover;"></div>
<div class="carousel-caption">
<h1>Caption 1</h1>
<p></p>
Read More »
<br/>
<div class="tech">
<img src="images/tech.png" />
</div>
</div>
</div>
<div class="item">
<div class="fill" style="background-image:url('images/slide2.jpg'); background-size:cover;"></div>
<div class="carousel-caption">
<h1>Caption 2</h1>
<p></p>
</div>
</div>
<div class="item">
<div class="fill" style="background-image:url('images/slide3.jpg'); background-size:cover;"></div>
<div class="carousel-caption">
<h1>Caption 3</h1>
</div>
</div>
</div>
In the comments provided to patel.milanb's answer, the author points to a live example of his problem: http://itechnepal.com/new_site//
The issue: The <ol> containing the carousel indicators overlaps a link, which therefor is not clickable.
Removing bottom: 10px; from .carousel-indicators will solve the issue.
CSS:
.carousel-indicators {
position: absolute;
/*bottom: 10px; <- remove this*/
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none;
}
As what i could understand from your question.
link is not working inside DIV
I would say you did not provided any link to your <a> tag
<a href="#" class="read">
replace with:
<a href="http://www.google.com/" class="read">
Update: remove your style from css
.carousel-indicators {
top: 180px;
}
look into bootstrap.css line no: 6590
OR remove bottom: 10px; from class .carousel-indicators Line no: 6523

Resources