I have an image that has a boarder appear from the top left to the center of the image when you scroll over it. I added a background image to the section and it covers that effect. I had that design working fine until I added the background image in the about class tag. I also am using bootstrap so maybe that could be interfering with something??
.about {
background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
url("img/sanfrancisco.jpg");
background-position: center;
background-size: cover;
background-attachment: fixed;
background-repeat: no-repeat;
position: relative;
}
.about-img__container {
position: relative;
}
.about-img__container::before {
content: "";
position: absolute;
top: -24px;
top: -1.5rem;
left: -27.2px;
left: -1.7rem;
width: 100%;
height: 100%;
outline: 8px solid #0000ff;
outline: 0.5rem solid #0000ff;
z-index: -1;
-webkit-transition: all 1s linear;
transition: all 1s linear;
}
.about-img__container:hover:before {
top: 0;
left: 0;
}
.about-banner {
color: #fff;
}
.about-banner-two {
color: #0000ff;
}
<section class="about py-5" id="about">
<div class="container">
<div class="row">
<div class="col-10 mx-auto col-md-6 my-5">
<h1 class="text-capitalize about-banner">
About <strong class="about-banner-two">us</strong>
</h1>
<p class="my-4 text-muted w-75">I have an image that has a boarder appear from the top left to the center of the image when you scroll over it. I added a background image to the section and it covers that effect. I had that design working fine until I added the background image in the about class tag. I also am using bootstrap so maybe that could be interfering with something??
</p>
</div>
<div class="col-10 mx-auto col-md-6 my-5 align-self-center">
<div class="about-img__container">
<img src="img/710-DC.jpg" class="img-fluid" alt="" />
</div>
</div>
</div>
</div>
<div class="row ">
<div class="col-md-12 text-center my-3 text-muted">
<i class="fas fa-truck-moving"></i>
<h6 class="text-uppercase my-3 mission-title">Our Mission</h6>
<p class="w-75 mx-auto text-left mission-text">I have an image that has a boarder appear from the top left to the center of the image when you scroll over it. I added a background image to the section and it covers that effect. I had that design working fine until I added the background image in the about class tag. I also am using bootstrap so maybe that could be interfering with something??
</p>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center my-3 text-muted">
<i class="fas fa-binoculars"></i>
<h6 class="text-uppercase my-3 mission-title">Our Vision</h6>
<p class="w-75 mx-auto text-center mission-text">I have an image that has a boarder appear from the top left to the center of the image when you scroll over it. I added a background image to the section and it covers that effect. I had that design working fine until I added the background image in the about class tag. I also am using bootstrap so maybe that could be interfering with something??
</p>
</div>
</div>
</div>
Change the z-index of .about-img__container::before pseudo-element. Give it a positive value like 1 or more. This would solve your problem 😅
Related
My image overlay is stretching on large screen. I have tried max-width but no solution. max-width destroys responsiveness on small screens.
I am trying to add transition on image so overlay will come when I will hover on image but issue is that img-overlay is stretched out on large screens
.head-txt {
font-size: 50px;
color: black;
}
.resource-img-height {
height: 400px;
object-fit: cover;
}
.font-color {
color: black;
}
.font-size-resourse {
font-size: 20px;
}
.resourse-book-txt-width {
width: 250px;
}
.img-overlay {
position: absolute;
/* max-width: 97%; */
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 1;
transition: 0.5s ease-in;
background-color: rgba(0, 0, 0, 0.8);
}
.book-img-div:hover .img-overlay {
opacity: 1;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<div class="col-lg-12 mt-1" style="background-color: white;">
<div class="row">
<div class="col-lg-3 img-div-pad-right img-div-pad-left book-img-div"><img src="https://via.placeholder.com/100" class="img-fluid resource-img-height" alt="">
<div class="img-overlay vw-100"></div>
</div>
<div class="col-lg-3 my-auto">
<h5 class="font-color mt-1">Book</h5>
<h1 class="font-color mt-1">Product Leadership</h1>
<p class="font-color mt-3 resourse-book-txt-width font-size-resourse">How Top Product Managers Launch Awesome Products and Build Successful Teams.</p>
</div>
<div class="col-lg-3 img-div-pad-right img-div-pad-left book-img-div"><img src="https://via.placeholder.com/100" class="img-fluid resource-img-height" alt="">
<div class="img-overlay"></div>
</div>
<div class="col-lg-3 my-auto">
<h5 class="font-color mt-1">Book</h5>
<h1 class="font-color mt-1">Product Leadership</h1>
<p class="font-color mt-3 resourse-book-txt-width font-size-resourse">How Top Product Managers Launch Awesome Products and Build Successful Teams.</p>
</div>
</div>
</div>
Add a few extra CSS image parameters (see below).
Overlay CSS parameters are fine (but set opacity: 0).
We think that the DIV placements are out of sequence, as the text needs to be inside so it can stack (see example below).
The class col-lg-3 may (or may not) need changed after its placed inside all of that.
We used JS comments to make it a bit easier to see arrangement of closing DIV's.
Example below uses only one (col-lg-3) DIV sets with image.
.resource-img-height {
display: block;
width: 100%;
/*--height: auto;--*/
height: 400px;
object-fit: cover;
}
.img-overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 0;
transition: 0.5s ease-in;
background-color: rgba(0, 0, 0, 0.8);
}
<div class="col-lg-3 img-div-pad-right img-div-pad-left book-img-div"><img src="https://via.placeholder.com/100" class="img-fluid resource-img-height" alt="">
<div class="img-overlay vw-100">
<div class="col-lg-3 my-auto">
<h5 class="font-color mt-1">Book</h5>
<h1 class="font-color mt-1">Product Leadership</h1>
<p class="font-color mt-3 resourse-book-txt-width font-size-resourse">How Top Product Managers Launch Awesome Products and Build Successful Teams.</p>
</div><!--// End text-->
</div><!--// End overlay-->
</div><!--// End column container and image-->
The mask i am applying should only make my background image darker but its making my h1 and button darker too
<!-- Header - set the background image for the header in the line below-->
<header class="bg-image d-flex justify-content-center align-items-center"
style="background-image: url('img/orange.jpg');
background-size: cover;
height: 75vh">
<div class="mask" style="background-color: rgba(0, 0, 0, 0.6)"></div>
<div class="text-center my-5">
<h1 class="text-white p-5">100% blended fruit juice concentrate<span style = "display: block;">specifically designed for childcare centers</span> </h1>
Order Now
</div>
</header>
I expected it to only make the background image darker
Modified the styles to adjust the layout of the divs
header {
position: relative;
}
.mask {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.text-center {
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
<header class="bg-image d-flex justify-content-center align-items-center" style="background-image: url('img/orange.jpg');
background-size: cover;
height: 75vh">
<div class="mask" style="background-color: rgba(0, 0, 0, 0.6)"></div>
<div class="text-center my-5">
<h1 class="text-white p-5">
100% blended fruit juice concentrate<span style="display: block;">specifically designed for childcare centers</span>
</h1>
Order Now
</div>
</header>
I have an issue where I am using a bootstrap jumbotron with a row. I am stuck with CSS and bootstrap to centre a row at the centre of the jumbotron container, making it responsive as a result. I am here because I have searched for the solution and did not find it.
`<div class="jumbotron jumbotron-fluid img-fluid">
<div class="row align-center jumbo-row">
<div class="col-12 col-md-4 align-self-center">
<h1>BUILD UP YOUR BODY TODAY</h1>
<h5>A truly epic gym</h5>
<h5>OPEN 24/7</h5>
<button type="button" class="btn btn-warning">Subscribe Now</button>
</div>
</div>
The CSS command:
.jumbotron {
background-image: linear-gradient( rgba(0, 0, 0, 0.4),
rgba(0, 0, 0, 0.4)),
url("../images/photos/gym4.jpg");
color: #fff;
margin-bottom: 0;
-webkit-box-align: end;
-ms-flex-align: end;
align-items: flex-end;
width: 100%;
min-height: 100vh;
background-size: cover;
background-position: center;
padding: 25px;}
.jumbotron h1 {
font-family: "Exo", font-family;
color: #ffff00;}
.jumbotron .container-fluid {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%)}
code outcome
fortunately, I found the answer. I just had to add a container-fluid below the jumbotron tag and add two bootstrap commands, such as (align-items-center (vertical alignment)) and (justify-content-center (horizontal alignment)) within the row tag and it responcively aligned the col at the center of the jumbotron.
<div class=" jumbotron jumbotron-fluid ">
<div class="container-fluid">
<div class="row align-items-center justify-content-center">
<div class="col-12 col-md-4 ">
<h1>BUILD UP YOUR BODY TODAY</h1>
<h5>A truly epic gym</h5>
<h5>OPEN 24/7</h5>
<button type="button" class="btn btn-warning">Subscribe Now</button>
</div>
</div>
</div>
I have an image like the b
Im trying to achieve an infinite line at the bottom so no matter what screen the line fills the width of the screen.
I have cropped my image and set it to the bottom of a div so i can use a boarder but when i use
.row2{
position: absolute;
width:500%;
overflow: hidden;
}
The div just seems to stretch 510% to the right rather than 250 to the left and 250 to the right and keeping my image the same size (it also moves my image to the center of the div so way off screen)
This is my html :
<div class="row row2">
<div class="col-xl-12 hscentertext" style="">
<img src="assets/img/25k.png" class="img-fluid center-block text-xl-center" alt="Responsive image">
</div>
</div>
I'm using bootstrap. Thanks in advance.
There's no need to use position: absolute; for this:
html, body {
background: red;
margin: 0;
padding: 0;
}
.row2 {
width: 100%;
border-bottom: 1px solid white;
}
.row2 .hscentertext {
text-align: center;
}
<div class="row row2">
<div class="col-xl-12 hscentertext" style="">
<img src="http://placehold.it/200x200" class="img-fluid center-block text-xl-center" alt="Responsive image">
</div>
</div>
Unless you have other reasons to use position: absolute; in which case can center it with transforms:
.selector {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
By using the translateX(-50%); trick the element will always be centered, regardless of it's width.
Since you did not provide the image, i remade one : cutting off edges for the snippet below:
.myimg {
background-color: #D52226;
/* draw the line behind*/
background-image: linear-gradient(to top, transparent 3px, white 3px, white 5px, transparent 5px);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row row2">
<div class="col-xl-12 hscentertext myimg" style="">
<img src="https://i.stack.imgur.com/Bf9Cy.jpg" class="img-fluid center-block text-xl-center" alt="Responsive image">
</div>
</div>
The width of that image used can be reduced to the text it holds.
The line can be drawn on the background of the container .
It can be a gradient or few pixel dot repeated over a background-color.
display:flex can help too to work from a translucide png, which allows background to be modify: example.
.myimg {
display: flex;
background-color: #D52226;
}
.myimg:before,
.myimg:after {
content: '';
flex: 1;
background: linear-gradient(to top, transparent 3px, white 3px, white 5px, transparent 5px);
}
.myimg:hover {
background-color: #4195BE
}
<div class="row row2">
<div class="col-xl-12 hscentertext myimg">
<img src="https://i.stack.imgur.com/37doI.png" class="img-fluid center-block text-xl-center" alt="Responsive image">
</div>
</div>
So I have this issue with positioning and aligning thumbnails. I want to put fixed width and height on a div but as I am using Bootstrap, I've put col-md and col-xs for responsiveness, and now I can't figure out how to fit every image no matter how big it is to be a fixed width and height. Ive tried percentage and px, but then it loses its mobility and responsiveness and stays fixed on that width. Here is a picture of the problem http://postimg.org/image/n4tnblczd/ . I would be very thankfull on some advice how to resize big pictures to fixed width and heights but to remain it's responsiveness.
Before asking question suggest as giving your sample code. I think you want to know the process of html structure.
Use below html code for bootstrap support. col-md and col-sm in div class. img class will be "img-responsive" . It will get bootstrap.min.css
<div class="col-md-6 col-sm-6 col-xs-12 text-left">
<img src="/images/choose-us.png" class="img-responsive">
</div>
Use this I think it will solve your problem.here is screenshot I applied using my css with different image size.
Below snippet code not displaying exact style because of bootstrap css link.
.thumbnail{
padding: 0px;
border-radius: 0px;
position: relative;
border: 1px solid #222;
}
.thumbnail img{
height: 347px;
}
.drzac{
margin-top: 30px;
}
.overlay{
display: block;
transition: all 0.3s;
-webkit-transition: all 0.3s;
background-color: rgba(50, 200, 235, 0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
font-size: 2em;
text-align: center;
}
<div class="col-xs-6 col-md-4">
<div class="thumbnail">
<img src="http://www.it4gen.com/wp-content/uploads/2013/02/learnindoorgrowing.com_-460x345.png" class="img-responsive">
<div class="centered"><i class="fa fa-search"></i></div>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div class="thumbnail">
<img src="http://www.totalcableusa.com/images/choose-us.png">
<div class="centered"><i class="fa fa-search"></i></div>
</div>
</div>
<div class="col-xs-6 col-md-4">
<div class="thumbnail">
<img src="http://www.totalcableusa.com/images/choose-us.png">
<div class="centered"><i class="fa fa-search"></i></div>
</div>
</div>