I have an overview page with tiles and I use the matchheight library to dynamically determine the height of a row. Now I would like to align the 'more' buttons at the bottom of the div so that it doesn't look as messy as in the screenshot on smaller screens.
I tried making the button "position: absolute" with "bottom: 20px" and "left: 40%" but that causes problems with responsiveness. On some resolutions that's okay, but on other's the button is too far to the right.
Can I solve this in a nice way without having to use the media attribute for each resolution?
/* Block: Overview */
#overview {
padding-top: 50px;
width: 100%;
}
.overview {
text-align: center;
padding-bottom: 50px;
}
.overview img {
width: 100%;
vertical-align: middle;
padding-bottom: 30px;
}
.card-title {
text-align: center;
letter-spacing: -1px;
font-weight: 600;
font-size: 20px;
}
.card-subtitle {
margin-bottom: 0;
font-style: italic;
font-weight: 400;
font-size: 15px;
font-family: "Lora", serif;
color: #cccccc;
margin-top: -1rem;
line-height: 1.7857;
padding-bottom: 1rem;
text-align: center;
}
.btn-card {
background-color: #cccccc;
border-color: #404040;
color: #404040;
letter-spacing: 2px;
padding: 10px 20px;
horiz-align: center;
position: relative;
margin-bottom: 0;
}
.btn-card:hover {
background-color: #ffffff;
color: #404040;
border-color: #404040;
letter-spacing: 2px;
padding: 10px 20px;
}
<div class="col-sm-3 overview row-eq-height">
<div class="col-sm-12 text-center wow fadeInLeft">
<img alt="Heavy Entertainment Show" src="/images/discography/the-heavy-entertainment-show-1.jpg">
</div>
<h3 class="card-title">Heavy Entertainment Show</h3>
<h4 class="card-subtitle">November 4<sup>th</sup>, 2016</h4>
<a href="/album/the-heavy-entertainment-show/" title="Show details of Heavy Entertainment Show">
<button class="btn btn-card">MORE</button>
</a>
</div>
<div class="col-sm-3 overview row-eq-height">
<div class="col-sm-12 text-center wow fadeInLeft">
<img alt="Under the Radar Vol 1" src="/images/discography/under-the-radar-vol-1-1.jpg">
</div>
<h3 class="card-title">Under the Radar Vol 1</h3>
<h4 class="card-subtitle">December 1<sup>st</sup>, 2014</h4>
<a href="/album/under-the-radar-vol-1/" title="Show details of Under the Radar Vol 1">
<button class="btn btn-card">MORE</button>
</a>
</div>
<div class="col-sm-3 overview row-eq-height">
<div class="col-sm-12 text-center wow fadeInLeft">
<img alt="Swings Both Ways" src="/images/discography/swings-both-ways-1.jpg">
</div>
<h3 class="card-title">Swings Both Ways</h3>
<h4 class="card-subtitle">November 18<sup>th</sup>, 2013</h4>
<a href="/album/swings-both-ways/" title="Show details of Swings Both Ways">
<button class="btn btn-card">MORE</button>
</a>
</div>
<div class="col-sm-3 overview row-eq-height">
<div class="col-sm-12 text-center wow fadeInLeft">
<img alt="Take the Crown" src="/images/discography/take-the-crown-1.jpg">
</div>
<h3 class="card-title">Take the Crown</h3>
<h4 class="card-subtitle">November 2<sup>nd</sup>, 2012</h4>
<a href="/album/take-the-crown/" title="Show details of Take the Crown">
<button class="btn btn-card">MORE</button>
</a>
</div>
This is the correct solution, adding a "transform:translateX(-50%);" for alignment. Thanks for the help!
.btn-card {
background-color: #cccccc;
border-color: #404040;
color: #404040;
letter-spacing: 2px;
padding: 10px 20px;
position: absolute;
bottom: 0;
left: 50%;
transform:translateX(-50%);
margin-bottom: 20px;
Related
I wanted the feature-list div on the next lint of image-computer but only at width 768px it doesn't go on the next line. For better understanding I have attached screenshot of desired result an actual result photo for reference. Please give me a better solution for this.
body {
background-image: url("images/bg-header-desktop.png");
background-size: contain;
background-repeat: no-repeat;
font-size: 18px;
font-family: 'Bai Jamjuree', sans-serif;
padding: 9% 0 0 0;
line-height: 1.5;
margin: 0;
}
p {
color: hsl(201, 11%, 66%);
}
h1,
h3,
h5,
h2 {
color: hsl(210, 10%, 33%);
font-weight: 600;
}
button {
margin-top: 1.25rem;
}
.btn-ios {
border: 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
color: #FFFFFF;
font-size: 18px;
font-weight: 100;
padding: 10px 35px;
background-color: #26BAA4;
-webkit-box-shadow: -1px 7px 15px -3px #35D9BD;
-moz-box-shadow: -1px 7px 15px -3px #35D9BD;
box-shadow: -1px 7px 15px -3px #35D9BD;
text-decoration: none;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-ios:hover {
background: #35D9BD;
border: solid #35D9BD 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
text-decoration: none;
}
.btn-mac {
border: 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
color: #FFFFFF;
font-size: 18px;
font-weight: 100;
padding: 10px 35px;
background-color: #6173FF;
-webkit-box-shadow: -1px 7px 15px -3px #7585FC;
-moz-box-shadow: -1px 7px 15px -3px #7585FC;
box-shadow: -1px 7px 15px -3px #7585FC;
text-decoration: none;
display: inline-block;
cursor: pointer;
text-align: center;
}
.btn-mac:hover {
background: #7585FC;
border: solid #7585FC 0;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 25px;
text-decoration: none;
}
.ios {
text-align: right;
}
.mac {
text-align: left;
}
.snippets {
margin-top: 5rem;
}
footer {
background-color: #f2f2f2;
margin-top: 5rem;
padding: 0 10%;
}
/* title */
#title {
text-align: center;
}
.para {
padding: 1% 24%;
}
.logo {
margin-bottom: 2.75rem;
}
/* features */
#features {
margin-top: 4rem;
}
.feature-list {
padding-left: 1rem;
padding-right: 17%;
}
.feature-list-div {
}
.center-feature {
text-align: center;
}
.clipboard {
margin-top: 8rem;
}
.image-computer {
position: relative;
right: 30px;
width: 93%;
}
.image-devices {
margin: 6rem auto 0 auto;
display: block;
width: 80%;
}
.feature-second {
text-align: center;
padding: 3% 10% 10% 10%;
}
.sponsers {
text-align: center;
padding: 0 10% 10% 10%;
}
/* cta */
#cta {
text-align: center;
}
/* footer */
.footer-logo {
width: 45%;
}
.footer-row {
padding-top: 3rem;
padding-bottom: 3rem;
}
.link {
text-decoration: none;
color: hsl(210, 10%, 33%);
}
.link:hover {
color: hsl(171, 66%, 44%);
}
.first-footer {
margin-bottom: 1.2rem;
display: block;
}
.social-icon {
text-align: right;
padding-top: 2rem;
}
.fb-icon:hover,
.twitter-icon:hover,
.insta-icon:hover {
color: hsl(171, 66%, 44%);
}
.fb-icon {
margin-right: 1rem;
}
.twitter-icon {
margin-right: 1rem;
}
.attribution {
font-size: 11px;
text-align: center;
margin-bottom: 0;
position: relative;
bottom: 5px;
}
.attribution a {
color: hsl(228, 45%, 44%);
}
#media (max-width: 970px) {
.feature-list{
padding-right: 10%;
}
}
#media (max-width: 768px) {
.feature-list{
text-align: center;
}
.image-computer{
text-align: center;
display: block;
position: static;
margin: auto;
width: 100%;
}
}
#media (max-width: 376px) {
body {
padding: 25% 12% 0 12%;
}
.para {
padding: 1rem 0 0 0;
}
.ios {
text-align: center;
}
.mac {
text-align: center;
}
}
<body>
<section id="title">
<img class="logo" src="images/logo.svg" alt="logo">
<h1 class="heading">A history of everything you copy</h1>
<p class="para">Clipboard allows you to track and organize everything you copy. Instantly access your clipboard on all your devices.</p>
<div class="container-fluid">
<div class="row">
<div class="col ios">
<button class="btn-ios" type="button" name="button">Download for iOS</button>
</div>
<div class="col mac">
<button class="btn-mac" type="button" name="button">Download for Mac</button>
</div>
</div>
</div>
<h1 class="snippets">Keep track of your snippets</h1>
<p class="para">Clipboard instantly stores any item you copy in the cloud,
meaning you can access your snippets immediately on all your devices. Our Mac and iOS apps will help you organize everything.</p>
</section>
<section id="features">
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
<h1 class="center-feature clipboard">Access Clipboard anywhere</h1>
<p class="center-feature para">Whether you’re on the go, or at your computer, you can access all your Clipboard snippets in a few simple clicks.</p>
<img class="image-devices" src="images/image-devices.png" alt="image-devices">
<h3 class="center-feature">Supercharge your workflow</h3>
<p class="center-feature para">We’ve got the tools to boost your productivity.</p>
<div class="container-fluid feature-second">
<div class="row">
<div class="col">
<img class="icon-feature" src="images/icon-blacklist.svg" alt="icon-blacklist">
<h5>Create blacklists</h5>
<p>Ensure sensitive information never makes its way to your clipboard by excluding certain sources.</p>
</div>
<div class="col">
<img class="icon-feature" src="images/icon-text.svg" alt="icon-text">
<h5>Plain text snippets</h5>
<p>Remove unwanted formatting from copied text for a consistent look.</p>
</div>
<div class="col">
<img class="icon-feature" src="images/icon-preview.svg" alt="icon-preview">
<h5>Sneak preview</h5>
<p>Quick preview of all snippets on your Clipboard for easy access.</p>
</div>
</div>
</div>
</section>
<div class="container-fluid sponsers">
<div class="row">
<div class="col-sm">
<img class="google" src="images/logo-google.png" alt="logo-google">
</div>
<div class="col-sm">
<img class="ibm" src="images/logo-ibm.png" alt="logo-ibm">
</div>
<div class="col-sm">
<img class="microsoft" src="images/logo-microsoft.png" alt="logo-microsoft">
</div>
<div class="col-sm">
<img class="hp" src="images/logo-hp.png" alt="logo-hp">
</div>
<div class="col-sm">
<img class="vector-graphics" src="images/logo-vector-graphics.png" alt="logo-vector-graphics">
</div>
</div>
</div>
<section id="cta">
<h2>Clipboard for iOS and Mac OS</h2>
<p class="para">Available for free on the App Store. Download for Mac or iOS, sync with iCloud and you’re ready to start adding to your clipboard.</p>
<div class="container-fluid">
<div class="row">
<div class="col ios">
<button class="btn-ios" type="button" name="button">Download for iOS</button>
</div>
<div class="col mac">
<button class="btn-mac" type="button" name="button">Download for Mac</button>
</div>
</div>
</div>
</section>
<footer>
<div class="container-fluid">
<div class="row footer-row">
<div class="col">
<img class="footer-logo" src="images/logo.svg" alt="logo">
</div>
<div class="col">
<a class="first-footer link" href="#">FAQs</a>
<a class="link" href="#">Contact Us</a>
</div>
<div class="col">
<a class="first-footer link" href="#">Privacy Policy</a>
<a class="link" href="#">Press Kit</a>
</div>
<div class="col">
<a class="link" href="#">Install Guide</a>
</div>
<div class="col social-icon">
<i class="fab fa-facebook-square fb-icon fa-2x"></i>
<i class="fab fa-twitter twitter-icon fa-2x"></i>
<i class="fab fa-instagram insta-icon fa-2x"></i>
</div>
</div>
</div>
<p class="attribution">
Challenge by Frontend Mentor.
Coded by Mohak Goel.
</p>
</footer>
</body>
this is actual result screenshot
this is desired result screenshot
If you want your columns on smaller displays to be the full width of the display, use col-12 without a size. Then pick your width to switch to two columns half the width of the display and add the appropriate class as in col-md-6. That will give you one full width column from a smartphone up to a tablet (767px wide). On anything larger (more than 767px wide), you would have two columns, each half the display width.
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-12 col-md-6">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-12 col-md-6 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
If you want your columns on smaller displays to be side-by-side and one column on wider (768px or more) displays, then you could use col-6 col-md-12
<div class="container-fluid">
<div class="row imac g-0">
<div class="col-6 col-md-12">
<img class="image-computer" src="images/image-computer.png" alt="image-computer">
</div>
<div class="col-6 col-md-12 feature-list">
<div class="feature-list-div">
<h3>Quick Search</h3>
<p>Easily search your snippets by content, category, web address, application, and more.</p>
<h3>iCloud Sync</h3>
<p>Instantly saves and syncs snippets across all your devices.</p>
<h3>Complete History</h3>
<p>Retrieve any snippets from the first moment you started using the app.</p>
</div>
</div>
</div>
</div>
I have a web page in HTML, with different page having some sections like below image
I need every sections to be of the same height, the first section in the image is perfect with the section only till the screen, but the second section in the 2nd image is a little below the screen like below
I need it to be like the first section, till the screen. My code:
body {
font-family: Montserrat;
}
/*.paddingTB60 {padding:100px 0px 60px 0px;}*/
.gray-bg {
background: #F1F1F1 !important;
margin-top: -11vh;
padding: 19.7vh;
}
p {
overflow: hidden;
color: #0a2240;
text-align: center-left;
font-size: 12pt;
font-weight: 600;
word-spacing: 2px;
}
.para1 {
overflow: hidden;
color: #0a2240;
text-align: center-left;
font-size: 12pt;
font-weight: 600;
word-spacing: 2px;
margin-left: -2.5vh;
}
.paddingTBB {
padding-top: 95px;
padding-bottom: 30px;
}
.paddingTB {
margin-top: 50px;
}
.paddingTBq {
margin-top: 50px;
}
.paddingTBq2 {
margin-top: 100px;
}
<div id="backtop">▲</div>
<div id="zub" class="about-section paddingTB60 gray-bg">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<div class=" about-title clearfix">
<div class="col-md-5 col-sm-5 how-img text-center">
<img src="img/teamweserve.png" class="img-fluid" alt="" />
</div>
<div class="col-md-7 col-sm-7">
<h1 class="tws">TEAMS WE SERVE</h1><br>
<p class="para1">CEOs face incessant barrage of “go to cloud”, “go digital”.</p>
<p class="para1">CFOs are under tremendous pressure to free-up or find capital in legacy IT to invest in digital, IT modernization.</p>
<p class="para1">CIOs/CTOs are in uneviable position to maintain legacy IT while transforming business for digital, cloud.</p>
<p class="para1">HR is struggling with talent and skills shortage.</p>
<p class="para1">Functional heads are under pressure to show results fast, and unknowingly give out critical information to suppliers.</p>
<p class="para1">Procurement/Sourcing are handed situations after the damage has been done by the organizational silos.</p>
</div>
</div>
</div>
<div class="login" id="theFormID1" action="">
<button type="submit" class="btn btn-warning" id="submit_on1" onclick="window.location.href='setupdiscussion.php'">SET UP A DISCUSSION</button>
</div>
</div>
</div>
</div>
How do I make it like that, can anyone help me?
Change this:
.gray-bg {
background: #F1F1F1 !important;
margin-top: -11vh;
padding: 19.7vh;
}
to
.gray-bg {
background: #F1F1F1 !important;
margin-top: -11vh;
padding: 19.7vh;
height: 900px;
overflow: hidden;
}
If you want to have a different height just change height: 900px; to height: what you want; and make sure that every grey section has the class gray-bg. You also might want to add overflow: hidden; to ensure that no content spills out of the div.
Snippet:
body {
font-family: Montserrat;
}
/*.paddingTB60 {padding:100px 0px 60px 0px;}*/
.gray-bg {
background: #F1F1F1 !important;
margin-top: -11vh;
padding: 19.7vh;
height: 900px;
overflow: hidden;
}
p {
overflow: hidden;
color: #0a2240;
text-align: center-left;
font-size: 12pt;
font-weight: 600;
word-spacing: 2px;
}
.para1 {
overflow: hidden;
color: #0a2240;
text-align: center-left;
font-size: 12pt;
font-weight: 600;
word-spacing: 2px;
margin-left: -2.5vh;
}
.paddingTBB {
padding-top: 95px;
padding-bottom: 30px;
}
.paddingTB {
margin-top: 50px;
}
.paddingTBq {
margin-top: 50px;
}
.paddingTBq2 {
margin-top: 100px;
}
<div id="backtop">▲</div>
<div id="zub" class="about-section paddingTB60 gray-bg">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<div class=" about-title clearfix">
<div class="col-md-5 col-sm-5 how-img text-center">
<img src="img/teamweserve.png" class="img-fluid" alt="" />
</div>
<div class="col-md-7 col-sm-7">
<h1 class="tws">TEAMS WE SERVE</h1><br>
<p class="para1">CEOs face incessant barrage of “go to cloud”, “go digital”.</p>
<p class="para1">CFOs are under tremendous pressure to free-up or find capital in legacy IT to invest in digital, IT modernization.</p>
<p class="para1">CIOs/CTOs are in uneviable position to maintain legacy IT while transforming business for digital, cloud.</p>
<p class="para1">HR is struggling with talent and skills shortage.</p>
<p class="para1">Functional heads are under pressure to show results fast, and unknowingly give out critical information to suppliers.</p>
<p class="para1">Procurement/Sourcing are handed situations after the damage has been done by the organizational silos.</p>
</div>
</div>
</div>
<div class="login" id="theFormID1" action="">
<button type="submit" class="btn btn-warning" id="submit_on1" onclick="window.location.href='setupdiscussion.php'">SET UP A DISCUSSION</button>
</div>
</div>
</div>
</div>
You can create a common class with the height whatever you want and add that class to all sections.
I have a group of three columns. Inside each column is the following:
A small circular div, which contains a font-awesome icon.
A small heading tag
Another div, which contains some text and a button.
I have been having issues with getting the third item to be an equal height with each other. I also need the buttons to be on the same height as well. I understand how to make divs the same height (shown here!)
However, I cannot get these divs to be of an equal height, and with the button to be in the same position. Here is the HTML code:
<div class="container-fluid">
<div class="row justify-content-center h-100">
<div class="col-3">
<div class="circleAboutUs">
<i class="fas fa-user-astronaut fa-5x" style="color: white; padding-top: 25px; padding-left: 34px;"></i>
</div>
<h1 class="about-us-text">Hackers</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
The early registration deadline is October 15th and regular registration closes November 3rd.
For more information check out the FAQ!
</div>
<button class="about-us-button" type="button"><h2>Register</h2></button>
</div>
</div>
<div class="col-3">
<div class="circleAboutUs">
<i class="fab fa-reddit-alien fa-5x" style="color: white; padding-top: 30px; padding-left: 28px"></i>
</div>
<h1 class="about-us-text">Mentors</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
Interested in volunteering to help our hackers the day of the event?
Sign up here to be a mentor for Codestellation.
</div>
<button class="about-us-button" type="button"><h2>Sign Up</h2></button>
</div>
</div>
<div class="col-3">
<div class="circleAboutUs">
<i class="fas fa-space-shuttle fa-rotate-270 fa-5x" style="color: white; padding-right: 27px; padding-top: 14px; padding-bottom: 5px"></i>
</div>
<h1 class="about-us-text">Sponsors</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
Codestellation can’t take off without our sponsors!
Learn more about what perks you’ll recieve and how your partnership will contribute to the event.
</div>
<button class="about-us-button" type="button"><h2>Sponsor</h2></button>
</div>
</div>
</div>
Here is the CSS:
.circleAboutUs {
border: 3px solid #FAA880;
margin: 0 auto;
border-radius: 100%;
height: 140px;
width: 140px;
background-color: #FAA880;
}
.about-us-content-container {
margin: auto;
border-radius: 10%;
background-color: #FAA880;
text-align: center;
margin-bottom: 60px;
}
.about-us-content-text {
font-family: 'Mina', 'Montserrat', monospace;
padding: 25px 25px;
font-size: 2em;
}
.about-us-text {
text-align: center;
color: #3A318C;
font-family: 'Mina', 'Montserrat', monospace;
font-weight: bold;
padding-top: 10px;
padding-bottom: 10px;
}
.about-us-button {
border-radius: 20%/50%;
border: 1px solid black;
text-align: center;
font-family: 'Mina', 'Montserrat', monospace;
font-weight: bold;
color: #3A318C;
margin-bottom: 10px;
padding-top:10px;
}
.about-us-button:hover {
cursor: pointer;
background-color: white;
}
.col-sm > .about-us-content-container {
height: 55px;
}
It currently looks this: Example
I want it to maintain its responsiveness, so the header and the div still stack nicely on mobile.
This behavior can be easily achieved by using flex box.
First, we create div wrapper for every child of all the columns in bootstrap.
We set the height of those children to 100% in order to make them fill the whole containers.
Then, we set flex-grow: 1 so the about-us-content-container will fill the whole container including spare spaces.
But now about-us-content-container will have an auto margin, which prevents it from filling the whole container. So, we have to set the margin to 0.
The about-us-content-container now fills all the spaces. But the button is still not at the bottom. We can get this by doing the same thing
Setting display to flex.
Setting flex-grow of the about-us-content-text to 1.
The buttons are now filling the whole width of about-us-content-container now. To avoid this, wrap a div around the buttons.
Here is the solution in Codepen: https://codepen.io/anhanhvina/pen/WKmoWQ
Below is the code that works. You can now add more classes to make it responsive.
.col-3 > div {
display: flex;
flex-direction: column;
height: 100%;
}
.about-us-content-container {
flex-grow: 1;
display: flex;
flex-direction: column;
margin: 0 !important;
}
.about-us-content-text {
flex-grow: 1;
}
.circleAboutUs {
border: 3px solid #FAA880;
margin: 0 auto;
border-radius: 100%;
height: 140px;
width: 140px;
background-color: #FAA880;
}
.about-us-content-container {
margin: auto;
border-radius: 10%;
background-color: #FAA880;
text-align: center;
margin-bottom: 60px;
}
.about-us-content-text {
font-family: 'Mina', 'Montserrat', monospace;
padding: 25px 25px;
font-size: 2em;
}
.about-us-text {
text-align: center;
color: #3A318C;
font-family: 'Mina', 'Montserrat', monospace;
font-weight: bold;
padding-top: 10px;
padding-bottom: 10px;
}
.about-us-button {
border-radius: 20%/50%;
border: 1px solid black;
text-align: center;
font-family: 'Mina', 'Montserrat', monospace;
font-weight: bold;
color: #3A318C;
margin-bottom: 10px;
padding-top:10px;
}
.about-us-button:hover {
cursor: pointer;
background-color: white;
}
.col-sm > .about-us-content-container {
height: 55px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row justify-content-center h-100">
<div class="col-3">
<div>
<div class="circleAboutUs">
<i class="fas fa-user-astronaut fa-5x" style="color: white; padding-top: 25px; padding-left: 34px;"></i>
</div>
<h1 class="about-us-text">Hackers</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
The early registration deadline is October 15th and regular registration closes November 3rd. For more information check
out the FAQ!
</div>
<div>
<button class="about-us-button" type="button">
<h2>Register</h2>
</button>
</div>
</div>
</div>
</div>
<div class="col-3">
<div>
<div class="circleAboutUs">
<i class="fab fa-reddit-alien fa-5x" style="color: white; padding-top: 30px; padding-left: 28px"></i>
</div>
<h1 class="about-us-text">Mentors</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
Interested in volunteering to help our hackers the day of the event? Sign up here to be a mentor for Codestellation.
</div>
<div>
<button class="about-us-button" type="button">
<h2>Sign Up</h2>
</button>
</div>
</div>
</div>
</div>
<div class="col-3">
<div>
<div class="circleAboutUs">
<i class="fas fa-space-shuttle fa-rotate-270 fa-5x" style="color: white; padding-right: 27px; padding-top: 14px; padding-bottom: 5px"></i>
</div>
<h1 class="about-us-text">Sponsors</h1>
<div class="about-us-content-container">
<div class="about-us-content-text">
Codestellation can’t take off without our sponsors! Learn more about what perks you’ll recieve and how your partnership
will contribute to the event.
</div>
<div>
<button class="about-us-button" type="button">
<h2>Sponsor</h2>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
I have a button near the bottom of the page that is centered. Additionally, I have three images that I centered by making each image a col-lg-2 with 3 empty columns in between each one. I cannot figure out why these two items don't line up nicely, and which one is the one that is off center.
https://codepen.io/colesam/full/OgamyB/
SCSS:
a {
color: $blue;
font-size: 1.4vw;
font-weight: 500;
line-height: 1.7vw;
transition: all 0.2s;
&:hover {
color: $orange;
font-size: 1.7vw;
cursor: pointer;
text-decoration: none;
}
&:focus {
color: $blue;
text-decoration: none;
&:hover {
color: $orange;
cursor: pointer;
}
}
}
body {
background: white;
color: $black;
font-family: 'Roboto', sans-serif;
font-weight: 300;
text-shadow: $text-shadow-light;
}
h2 {
font-size: 5vh;
margin-top: 5vh;
}
p {
font-size: 3vh;
letter-spacing: 2px;
margin-top: 3vh;
text-shadow: none;
}
.btn-next {
bottom: 0;
padding-bottom: 5vh;
position: absolute;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
.center-text {
text-align: center;
}
.left-text {
text-align: left;
}
.no-margin {
margin: 0;
}
.right-text {
text-align: right;
}
.title {
padding-left: 4vw;
h3 {
font-size: 3vw;
text-shadow: $text-shadow;
}
}
#portfolio-page {
min-height: 100vh;
position: relative;
}
h4 {
font-size: 2vw;
}
.active-item {
box-shadow: $box-shadow-o;
-moz-box-shadow: $box-shadow-o;
-webkit-box-shadow: $box-shadow-o;
}
.btn-portfolio {
padding-top: 20vh;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
#featured-content {
background: rgba(0, 0, 0, 0.1);
height: 65vh;
margin-top: 2vh;
padding: 3vh 0;
}
#featured-img img {
box-shadow: $box-shadow-light;
-moz-box-shadow: $box-shadow-light;
-webkit-box-shadow: $box-shadow-light;
}
#primary-featured {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
height: 45.5vh;
top: 10%;
}
#secondary-featured {
margin-top: 3vh;
}
HTML(inside a div.container):
<div id="portfolio-page">
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<h2 class="center-text">My Portfolio</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12" id="featured-content">
<div class="row no-margin">
<div class="col-lg-1 btn-portfolio" id="left-button">
<a><i class="glyphicon glyphicon-chevron-left"></i></a>
</div>
<div class="col-lg-8 col-lg-offset-1" id="primary-featured">
<div class="row">
<div class="col-lg-5" id="featured-img">
<img src="includes/img/headers.jpg" alt="A cluster of header images." class="img-responsive">
</div>
<div class="col-lg-6 col-lg-offset-1" class="center-text">
<h4 id="featured-title">Placeholder</h4>
<hr>
<p id="featured-description">Placeholder text.</p>
</div>
</div>
</div>
<div class="col-lg-1 col-lg-offset-1 btn-portfolio" id="right-button">
<a><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
<div class="col-lg-6 col-lg-offset-3" id="secondary-featured">
<div class="row">
<div class="col-lg-2" id="secondary-feature1">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature2">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature3">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
</div>
Edit: Your problem is with position: absolute on .btn-next.
For absolutely positioned elements
This property specifies the distance between the left margin edge of
the element and the left edge of its containing block.
You have margin-left: -15px, so it aligns to center with the margin-left: -15px.
How to fix:
Add this to .btn-next:
right: 0;
left: 0;
...or you can remove position: absolute from .btn-next.
Alternative option:
The "down arrow" at the bottom isn't centered, because it's in the row class and that class has margin-left: 15px and margin-right: 15px.
If you give it margin: 0px, it'll be fine.
Rename div class="row" to something else or give it another class like div class="row down".
Examples:
<div class="down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
or
<div class="row down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
CSS (only if using second option):
.row.down {
margin: 0px;
}
Is there are any way of making carousel attachment fixed just like we can use to make background-image attachment fixed? Example
https://jsfiddle.net/5c3b56a7/3/
if there are any way of fixing slider background attachment that would be really helpfull for me thanks.
<div id="main-slider" class="owl-carousel owl-theme text-center">
<div class="item text-center">
<div class="position col-lg-12 text-center">
<h1 class="swiper-slide text-center">
<strong>
welcome to the shop
</strong>
</h1>
<p class="subtitle">
<span>
Take your time looking around & don't be shy
</span>
</p>
<p class="top-space">
<button type="button" class="btn btn-default btn-lg button hvr-float-shadow" id="focus">
START BROWSING
</button>
</p>
</div>
<img src="img/front_girl1.jpg">
</div>
<div class="item text-center">
<div class="position col-lg-12 text-center">
<h1 class="swiper-slide">
<strong>
Huge summer sale
</strong>
</h1>
<p class="subtitle">
<span>
All sunglasses 50% off while supplies last
</span>
</p>
<p class="top-space">
<button type="button" class="btn btn-default color-red btn-lg button hvr-float-shadow" id="focus">
SHOP SUNGLASSES
</button>
</p>
</div>
<img src="img/front_girl_3.jpg" style="background-position:fixed">
</div>
<div class="item text-center">
<div class="position col-lg-12 text-center">
<h1 class="swiper-slide">
<strong>
Make a statement
</strong>
</h1>
<p class="subtitle">
<span>
Check the store for more information
</span>
</p>
<p class="top-space">
<button type="button" class="btn btn-default color-green btn-lg button hvr-float-shadow" id="focus">
SHOP COATS
</button>
</p>
</div>
<img src="img/front_girl_2.jpg" style="background-position:fixed">
</div>
</div>
My CSS
/*slider*/
#main-slider .item img{
display: block;
width: 100%;
height:700px;
z-index: -1;
}
.position{
position: absolute;
padding-top: 240px;
}
.swiper-slide{
text-transform: uppercase;
letter-spacing: 3px;
font-size: 60px;
line-height: 79px!important;
color: #fff;
}
.subtitle{
font-family: 'Rouge Script', cursive;
font-size: 40px;
line-height: 39px!important;
font-weight: 400;
color: #fff;
font-style: italic;
}
strong{
font-weight: bold;
}
.btn-default{
background-color: #5cbcf6;;
border-radius: 0px;
color: #fff;
height: 61px;
margin-bottom: 20px;
font-size: 15px;
width: 250px;
float: none;
text-align: center;
border: none;
letter-spacing: 3px;
text-transform: uppercase;
}
.btn-default:hover{
background-color: #5cbcf6;;
border-radius: 0px;
color: #fff;
height: 61px;
margin-bottom: 20px;
font-size: 15px;
width: 250px;
float: none;
text-align: center;
border: none;
letter-spacing: 3px;
text-transform: uppercase;
`enter code here`}
.color-red{
background-color:#ff4f57!important;
}
.color-green{
background-color: #54df92!important;
}
.top-space{
padding-top: 30px;
}
.top-spacing{
padding-top: 60px;
}
.space-from-top{
margin-top: 30px;
}