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-->
Related
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 been trying very hard to make a split screen using Bootstrap. Here's what it looks like when I managed to do it with CSS:
But I need to make it responsive to mobile users so I'm remaking it with Bootstrap. However the image and textbox don't resize for some reason.
By responsive I mean that it should become single row with 2 columns and vice versa depending wether you're on a desktop or mobile.
Edit: Sorry for this sudden change, but I'm now using Bootstap ver5.
#promotion-textbox {
top: 115px;
display: inline-block;
margin-right: 5vw;
left: 55%;
background-color: white;
object-fit: fill;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
#promotion-title {
padding: 10px;
position: static;
color: #23272a;
font-size: 3vw;
overflow: hidden;
display: inline-block;
}
#promotion-button {
width: 40vw;
opacity: 0.8;
left: 75%;
transform: translate(-50%, -75%);
margin-left: auto;
margin-right: auto;
top: 620px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="row">
<!-- First Half -->
<div class="col-md-6">
<img class="img" src="https://via.placeholder.com/100">
</div>
<!-- Second Half -->
<div class="col-md-6">
<div id="promotion-textbox">
<div id="promotion-title">
Duck Zone is the best game of all time, I mean just look at these awesome reviews:<br /><br /> TheP0mp21 Says:<br />- Game is pretty good but it needs a your mum duck that is extremely fat and spawns other ducks.
</div>
</div>
</div>
</div>
A few things, if you are using a library then take advantage of it, use its utility classes, and learn its grid system:
Add vh-100 utility class to your row
Add w-100 h-100 in img tag HTML and in CSS add object-fit: cover
Because you've updated your question from bootstrap-4 to ootstrap-5, to remove the spacing in order to hide the horizontal scrollbar you need to replace no-gutters to g-0
Note: You have a lot of styles that doesn't make sense, such left/top without position
I also I've improved your code
#promotion-textbox {
background-color: white;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
margin-bottom: 20px;
}
#promotion-title {
padding: 10px;
color: #23272a;
font-size: 3vw;
}
#promotion-button {
opacity: 0.8;
border: 2px solid #fff;
color: #fff;
padding: 10px 20px;
background: transparent;
}
img {
object-fit: cover
}
.col-6:last-child {
background: darkgray
}
.promotion-column {
display: flex;
flex-direction: column;
padding: 20px;
align-items: center;
justify-content: center;
height: 100%;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="row g-0 vh-100">
<!-- First Half -->
<div class="col-md-6">
<img class="img w-100 h-100" src="https://picsum.photos/300/200">
</div>
<!-- Second Half -->
<div class="col-md-6">
<div class="promotion-column">
<div id="promotion-textbox">
<div id="promotion-title">
Duck Zone is the best game of all time, I mean just look at these awesome reviews:<br /><br /> TheP0mp21 Says:<br />- Game is pretty good but it needs a your mum duck that is extremely fat and spawns other ducks.
</div>
</div>
<button type="button" id="promotion-button">All Projects</button>
</div>
</div>
</div>
You must use responsive image if you want it to be responsive. I also removed gutters from the row.
EDIT: made some improvment, height:100vh is really helpful. Takes exactly the height of the window.
.half {
border: 1px solid red;
height: 100vh;
position: relative;
}
.my-image {
width: 100%;
height: 100%;
}
#promotion-textbox {
top: 115px;
display: inline-block;
background-color: white;
object-fit: fill;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
#promotion-title {
padding: 10px;
position: static;
color: #23272a;
font-size: 3vw;
overflow: hidden;
display: inline-block;
}
#promotion-button {
width: 40vw;
opacity: 0.8;
left: 75%;
transform: translate(-50%, -75%);
margin-left: auto;
margin-right: auto;
top: 620px;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<div class="row no-gutters">
<!-- First Half -->
<div class="half col-sm-6">
<img class="img my-image" src="https://picsum.photos/536/354">
</div>
<!-- Second Half -->
<div class="half col-sm-6">
<div id="promotion-textbox">
<div id="promotion-title">
Duck Zone is the best game of all time, I mean just look at these awesome reviews:<br /><br /> TheP0mp21 Says:<br />- Game is pretty good but it needs a your mum duck that is extremely fat and spawns other ducks.
</div>
</div>
</div>
</div>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
<p>content </p>
To make a split screen (two columns) use .row as parent and .col-md-6 for children. "md" part means that columns will expand to full screen width on medium and smaller screens( you can choose: xxl, xl, lg, md, sm, xs). TO make it fit the screen vertically add min-height: 100vh; for both columns and media query for the break point with min-height: 50vh;
source: https://getbootstrap.com/docs/4.6/layout/grid/
Bootstrap 4 example (works in bootstrap 5 and 4):
CSS:
.img-col{
background: url(https://via.placeholder.com/100) center center no-repeat;
background-size: cover;
}
.min-h-50{
min-height:100vh;
}
#media only screen and (max-width: 767px) {
.min-h-50{
min-height:50vh;
}
}
HTML:
<div class="row">
<div class="col-md-6 img-col min-h-50">
</div>
<div class="col-md-6 bg-dark min-h-50">
<div class="row justify-content-center h-100">
<div class="col-10 align-self-center">
<div class="bg-white p-3">rff</div>
<div class="mt-3 text-center"><button class="btn btn-primary">xxx</button></div>
</div>
</div>
</div>
</div>
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 😅
I am coding my first website. I am attempting to create a vertical timeline using Bootstrap 4, where the bar of the timeline is in between two columns. Currently, I cannot place text in the first column and an image directly to the right in the second column. The image is always pushed down to the next row. When I examine the element, I notice a large margin (orange area). How do I remove this?
This is my first post on Stack Overflow. I apologize if this is a bit long.
Thanks!
Relevant Code
<div class="row mt-3 no-gutters">
<div class="col-md-12">
<div class="timeline">
<div class="timeline-item-left">
<div class="col-md-6 text-right p-3 mr-0">
<h3>December 2017</h3>
<h5>Big Basin Redwoods State Park </h5>
Berry Creek Falls Loop | 10 Miles
</div>
<div class="offset-md-6 col-md-6 text-left">
<a href="adventure_images/big_basin.jpg">
<img src="adventure_images/big_basin.jpg" class="img-thumbnail" alt="Big Basin" width="150">
</a>
</div>
</div>
CSS
.timeline {
position: relative;
max-width: 800px;
margin: 0 auto;
}
/* Containers around content */
.timeline-item-left {
padding: 10px 30px;
position: relative;
/* background-image: <img src="adventure_images/spiration_light.png">;
background-repeat: repeat-x; */
background-color: white;
width: 100%;
}
.timeline-item-right {
padding: 10px 30px;
position: relative;
/* background-image: <img src"adventure_images/spiration_light.png">;
background-repeat: repeat-x;*/
background-color: white;
width: 100%;
}
Inspection of Element Screenshot
Website Link (for more detailed inspection)
You can use below css in your style.
.timeline-item-left,.timeline-item-left {display: flex}
and remove class offset-md-6.
Try below
.timeline-item-left {
padding: 10px 30px;
position: relative;
background-color: white;
width: 100%;
display: flex;
}
remove offset-md-6
<div class="offset-md-6 col-md-6 text-left">
Hello i spent hours doing this but still can't align the social media icons to the center of text "Connect with us" when it's in desktop size. It's only aligned when it's in mobile size i want them to align to center either its desktop size or mobile. I want the content of the footer to be responsive. I already used media queries but i encounter a problem so i repeat my footer again from the start because its not responsive when in desktop size. Please give me some ideas how to do it or suggestions. Im new to html and css.
here is the desktop size. I want the social media icons to align to the center of text "Connect with us".
here is the mobile size. Its well aligned here.
UPDATE:
This is what i want to do in the first picture. But i repeat my footer because when i minimized it as a desktop its not responsive the alignments, the text, the height it's a disaster so i decided to do it again from the start. I already used media queries before but as a desktop its not working when i minimized it it's not responsive but in mobile size its working.
here is my html code for the footer.
<div class="content">
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col col-sm-4">
<h4 class="connect">Connect With Us</h4>
<div class="twitter-hover social-slide"></div>
<div class="facebook-hover social-slide"></div>
<div class="linkedin-hover social-slide"></div>
</div>
</div>
</div>
</div>
</footer>
here is my css code.
* {
margin: 0;
}
html, body {
height: 100%;
overflow: auto;
}
.content {
min-height: 100%;
/* equal to footer height */
margin-bottom: auto;
}
.content:after {
content: "";
display: block;
}
.footer, .content:after {
height: auto;
}
.footer {
display: block;
background-color: #a92419;
color:#fff;
font-family: Century Gothic;
width: 100%;
height: auto;
}
h4{
text-align: center;
padding-top: 20px;
}
.twitter-hover {
background-image: url('images/twitter-hover.png');
margin-left: 65px;
}
.facebook-hover {
background-image: url('images/facebook-hover.png');
margin-left: 15px;
}
.linkedin-hover {
background-image: url('images/linkedin-hover.png');
margin-left: 15px;
}
.social-slide:hover {
background-position: 0px -48px;
box-shadow: 0px 0px 4px 1px rgba(0,0,0,0.8);
}
.social-slide{
height: 35px;
width: 38px;
float:left;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
-ms-transition: all ease 0.3s;
transition: all ease 0.3s;
}
Update: rewritten my answer completely.
You shouldn't use float:left when you want your content to be centered.
<div class="footer-col col-sm-4">
<h4 class="connect">Connect With Us</h4>
<ul>
<li><span class="twitter-hover social-slide"></span></li>
<li><span class="facebook-hover social-slide"></span></li>
<li><span class="linkedin-hover social-slide"></span></li>
</ul>
</div>
css:
.footer-col h4 {
text-align: center;
}
.footer-col ul {
list-style: none;
text-align: center;
}
.footer-col li {
display: inline;
}
.social-slide {
display: inline-block;
height: 35px;
width: 38px;
line-height: 35px;
margin-left: 15px;
/* don't use float: left! */
}
.social-slide:first-child {
margin-left: 0;
}
.twitter-hover { background-image: url('images/twitter-hover.png'); }
.facebook-hover { background-image: url('images/facebook-hover.png'); }
.linkedin-hover { background-image: url('images/linkedin-hover.png'); }
if you also use bootstrap latest then you use this class
col-sm-offset-......12
you don't know what size of your device you adjust self` col-sm-offset........12345 up to12
for more detail read out
https://getbootstrap.com/examples/grid/
Here is the fiddle
https://jsfiddle.net/brunocoder/ozgntcm2/1/
First of all there is one extra closing div in your footer tag.
You need to use bootstrap offset property to centralize your column. Here is the link http://getbootstrap.com/css/#grid
So your code should be something like this.
Modified HTML
<div class="content">
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col col-sm-4 col-md-4 col-lg-4 col-md-offset-4">
<h4 class="connect">Connect With Us</h4>
<div class="twitter-hover social-slide"></div>
<div class="facebook-hover social-slide"></div>
<div class="linkedin-hover social-slide"></div>
</div>
</div>
</div>
</footer>
Use bootstrap in every section of your code, like if you have used div inside the div , use bootstrap to align them also as if you not then it will not align themselves according to the screen size.
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col col-sm-4 col-md-4 col-lg-4 col-md-offset-4">
<h4 class="connect">Connect With Us</h4>
<a href="https://twitter.com/official_gapc" target="_blank" title="Follow us on Twitter">
<div class="twitter-hover social-slide col-sm-4">
</div>
</a>
<a href="https://www.facebook.com/pages/Governor-Andres-Pascual-CollegeNavotas-City/344134628983014?fref=ts" target="_blank" title="Like us on Facebook">
<div class="facebook-hover social-slide col-sm-4">
</div>
</a>
<a href="https://www.linkedin.com/edu/governor-andres-pascual-college-in-navotas-city-39345" target="_blank" title="Join us on Linkedin">
<div class="linkedin-hover social-slide col-sm-4">
</div>
</a>
</div>
<div class="footer-col col-sm-4 col-md-4 col-lg-4 col-md-offset-4"></div>
<div class="footer-col col-sm-4 col-md-4 col-lg-4 col-md-offset-4"></div>
</div>
</div>
</footer>
place anything you want to place in two div below or remain as it is, might it will help you to make responsive footer.