Hiding edge of section behind other sections - html

I'm fairly new to HTML & CSS, so I can't solve the development problem I'm facing. I have a footer design that looks like this:
The map section should slightly hide behind the above and beyond section. I'm using bootstrap and right now I achieved only this:
I know that this should be solved with relative and absolute positioning. I gave the footer id position: relative and added the absolute position to the map section, but the map section disappeared alltogether. I obviously don't know what I'm doing, so I'm hoping you can help me.
My HTML for the footer looks like this:
<section id="footer">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="text-center"> Join Our Team</h2>
<div class="teamview">
<img src="img/team1.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team2.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team3.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team4.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team5.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/teamu.png" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team7.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/team8.jpg" class="img-circle" alt="Team" style="width:62px;height:62px;">
</div>
<!--end teamview-->
<button type="button" class="btn btn-link center-block green" role="link" type="submit" name="op" value="Link 2">see our vacancies<span class="notify">2</span></button>
<div class="contact-us">
<p class="text-center">Get in touch with Dolm IT, we’d love to help and work with you.</p>
<h2 class="text-center">(+372) 56 247 399</h2>
info#dolmit.com
<p class="text-center">Dolm IT office: Parda 12, 10151, Tallinn, Estonia</p>
<p class="text-center">Official address: Pärnu mnt 122-20, 11313, Tallinn, Estonia</p>
</div>
<!--end contact us-->
</div>
<!--end col-md-12-->
</div>
<!--end row -->
</div>
<!--end container-->
</section>
<!--end footer-->
<div id="map"></div>
<section id="footer-bottom">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="social-media">
<img src="img/linkedin.svg" class="img-circle" alt="Team" style="width:62px;height:62px;">
<img src="img/fb.svg" class="img-circle" alt="Team" style="width:62px;height:62px;">
</div>
<!--end social-media-->
<div class="copyright small">
<p class="text-center">Dolm IT © 2016</p>
</div>
</div>
<!--end col-md-12-->
</div>
<!--end row -->
</div>
<!--end container-->
</section>
<!--end footer bottom-->
And the CSS:
/*footer*/
#footer {
background: url("../img/footerbg.png") no-repeat left top;
width: 100%;
background-size: cover;
padding: 100px 0 150px 0;
}
#footer h2 {
color: #ffffff;
}
.teamview {
display: flex;
justify-content: center;
margin-top: 40px;
}
.teamview img {
border: 3px solid #1dcb8b;
margin-right: 45px;
}
.btn-link.green {
position: relative;
}
.contact-us {
margin-top: 60px;
}
.contact-us h2 {
font-size: 4rem;
color: #ffffff;
}
.contact-us p {
color: #ffffff;
}
.contact-us a {
display: block;
font-size: 4rem;
color: #1dcb8b;
}
.contact-us a:hover {
text-decoration: none;
}
.contact-us a:after {
display: block;
margin: 40px auto 30px;
width: 100px;
height: 3px;
content: '';
background: #1dcb8b;
}
#map {
width: 100%;
height: 400px;
}
.social-media {
display: flex;
justify-content: center;
margin: 40px 0 25px 0;
}
.social-media a {
margin: 0 15px;
}
.copyright p {
color: #ffffff;
font-weight: 400;
font-size: 1.1rem;
}
#footer-bottom {
background: url("../img/social_media_bg.png") no-repeat left top;
width: 100%;
background-size: cover;
padding: 90px 0 50px 0;
}
Is there an easy solution to this? Here's a demo page as well. Thank you for your help.

In your CSS use this for #map
#map {
width: 100%;
height: 400px;
margin-bottom: -110px;
margin-top: -130px;
z-index: -1;
}

Related

Element with position absolute and bottom: 0px; doesnt stich to the bottom

Im new to code,
I gave the image element(the bee), position: absolute and bottom: 0px, in order to make the element stick to the bottom of the body i.e. the bottom of the page. However, if I dont give the body position: relative, it doesnt work! Based on what I learnt, if there is no any parent that has position that is not static it automatically set itself in relation to the body, so it doesnt work in that case?
HTML
<body>
<img src="https://media.npr.org/assets/img/2018/06/07/gettyimages-200415242-001_slide-d26f3af782b697f15ceebe2f7c380c0e545dd47b.jpg" alt="" class="test-bee">
<div class="container">
<div class="main">
<div class="info">
<h1>10,000+ of our users love our products.</h1>
<p>We only provide great products combined with excellent customer service.
See what our satisfied customers are saying about our services.</p>
</div>
<div class="rates">
<div class="rate-container">
<div class="star-container">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
</div>
<p class="review">Rated 5 Stars in Reviews</p>
</div>
<div class="rate-container">
<div class="star-container">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
</div>
<p class="review">Rated 5 Stars in Report Guru</p>
</div>
<div class="rate-container">
<div class="star-container">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
<img src="./images/icon-star.svg" alt="">
</div>
<p class="review">Rated 5 Stars in BestTech</p>
</div>
</div>
</div>
<section class="testemonies">
<div class="testemony-card">
<div class="user-info">
<div class="img-container">
<img src="./images/image-colton.jpg" alt="">
</div>
<div class="user-name-status">
<p class="user-name">colton smith </p>
<p class="status"><span>verified buyer</span></p>
</div>
</div>
<p class="testimony">"We needed the same printed design as the one we had ordered a week prior.
Not only did they find the original order, but we also received it in time.
Excellent!"</p>
</div>
<div class="testemony-card">
<div class="user-info">
<div class="img-container">
<img src="./images/image-irene.jpg" alt="">
</div>
<div class="user-name-status">
<p class="user-name">irene roberts </p>
<p class="status"><span>verified buyer</span></p>
</div>
</div>
<p class="testimony">
"Customer service is always excellent and very quick turn around. Completely
delighted with the simplicity of the purchase and the speed of delivery."</p>
</div>
<div class="testemony-card">
<div class="user-info">
<div class="img-container">
<img src="./images/image-anne.jpg" alt="">
</div>
<div class="user-name-status">
<p class="user-name">anne wallace </p>
<p class="status"><span>verified buyer</span></p>
</div>
</div>
<p class="testimony">
"Put an order with this company and can only praise them for the very high
standard. Will definitely use them again and recommend them to everyone!"</p>
</div>
</section>
</div>
</body>
CSS
* {
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
:root {
--Very-Dark-Magenta: hsl(300, 43%, 22%);
--Soft-Pink: hsl(333, 80%, 67%);
--Dark-Grayish-Magenta: hsl(303, 10%, 53%);
--Light-Grayish-Magenta: hsl(300, 24%, 96%);
--White: hsl(0, 0%, 100%);
}
body {
width: 100%;
min-height: 100vh;
font-family: 'League Spartan', sans-serif;
font-size: 15px;
display: flex;
align-items: center;
justify-content: center;
/* border: 5px solid red; */
padding: 1em;
position: relative; /*why do i need this relative? the bottom image should stick to the bottom by default cause the body is the first one that had position relative, but without it it doesnt stick*/
}
.pattern {
display: none;
}
.test-bee {
width: 200px;
position: absolute;
bottom: 0px;
}
.bottom-mobile, .top-mobile {
display: block;
position: absolute;
}
.top-mobile {
top:0px;
}
.bottom-mobile {
bottom: 0px;
}
.container {
height: 100%;
/* border: 5px solid green; */
margin: 3em 0px;
}
.main {
text-align: center;
margin-bottom: 3em;
}
.info h1 {
margin: 0px auto;
line-height: 0.8em;
margin-bottom: 1em;
margin: 1em 2em;
color: var(--Very-Dark-Magenta)
}
.info {
line-height: 1.3em;
margin-bottom: 2.5em;
}
.rate-container {
background-color: var(--Light-Grayish-Magenta);
padding: 1em 2em;
margin-bottom: 1em;
border-radius: 0.4em;
display: flex;
flex-direction: column;
gap: 0.5em;
color: var(--Very-Dark-Magenta);
font-weight: bold;
}
.testemonies {
display: flex;
flex-direction: column;
gap: 1em;
}
.testemony-card {
background-color: var(--Very-Dark-Magenta);
border-radius: 0.4em;
color: white;
padding: 2em;
line-height: 1.2em;
}
.img-container {
width: 30px;
height: 30px;
border-radius: 50px;
overflow: hidden;
}
.img-container img {
height: 100%;
width: 100%;
}
.user-info {
display: flex;
align-items: center;
gap: 1em;
text-transform: capitalize;
margin-bottom: 1em;
}
.user-name-status p span{
color:var(--Soft-Pink)
}
I fix it by adding the body position: relative, but it should go like that

how to put the text below the images without {css}

Whenever I'm trying to change .tea to display: block; all the images change their position from being horizontal, to being vertical
How to position it the correct way so the images keep being horizontally aligned and the text will be underneath
.tea {
display: inline-flex;
margin-left: 225px;
padding: 20px;
justify-content: center;
}
.tea h4 {
display: inline-block;
position: relative;
text-align: center;
}
.tea2 {
display: inline-flex;
margin-left: 385px;
}
.tea img {
width: 300px;
height: 200px;
padding: 25px;
border-radius: 15px;
}
.tea2 img {
width: 300px;
height: 200px;
padding: 30px;
}
<div class="tea">
<img class="1" src="https://via.placeholder.com/150">
<h4>Myrtle Ave</h4>
<img class="2" src="https://via.placeholder.com/150">
<h4>Spiced rum</h4>
<img class="3" src="https://via.placeholder.com/150">
<h4>Berry Blitz</h4>
</div>
<div class="tea2">
<img class="1" src="https://via.placeholder.com/150">
<img class="2" src="https://via.placeholder.com/150">
</div>
You should do it like this
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
#gallery {
display: flex;
flex-wrap: wrap;
}
#gallery .image-container {
width: 25%;
background-color: lightgreen;
border-radius: 5px;
padding: 5px;
box-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
}
#gallery img {
width: 100%;
}
#gallery .title {
font: bold 24px monospace;
text-align: center;
color: white;
margin: 2%;
}
<div id="gallery">
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 1</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 2</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 3</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 4</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 5</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 6</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 7</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 8</p>
</div>
</div>
You need to change you HTML to support what you want. Use a container wrapper around the image and image text.
Example: https://jsfiddle.net/Lqupmf5s/
<div class="tea">
<div class="img-container">
<img class="1" src="32131">
<h4>Myrtle Ave</h4>
</div>
<div class="img-container">
<img class="2" src="3213">
<h4>Spiced rum</h4>
</div>
<div class="img-container">
<img class="3" src="3213">
<h4>Berry Blitz</h4>
</div>
</div>
.tea {
display: inline-flex;
/* margin-left: 225px; */
padding: 20px;
justify-content: center; }
.tea h4{
display: inline-block;
position: relative;
text-align: center; }
.tea2 {
display: inline-flex;
margin-left: 385px; }
.tea img {
width: 300px;
height: 200px;
/* padding: 25px; */
border-radius: 15px; }
.tea2 img {
width: 300px;
height: 200px;
padding: 30px; }

Making a footer of fixed height for all pages in html and css

I have been designing a website using html and css, for which i have made a footer.
the code for the footer is as follows:
footer {
color: white;
width: 100%;
height: 40px;
padding: 0;
display: block;
clear: both;
}
.footrow {
overflow: hidden;
background-color: #111;
display: block;
line-height: 18px;
background-image: url('../images/footer.jpg');
}
.footrow2 {
overflow: hidden;
background-color: #002c42;
display: block;
padding: 15px;
height: 48px;
}
.foot {
max-width: 1080px;
margin: 0 auto;
font-size: 11px;
}
.foot-p {
font-weight: 600;
color: #66e355 !important;
margin: 15px;
}
.half-width {
width: 50%;
float: left;
line-height: 1px;
}
.quarter-width {
width: calc(25% - 30px);
float: left;
padding: 20px;
}
#social2 {
display: block;
background-color: transparent;
float: left;
margin: 0 auto;
}
.sc-icn2 {
width: 50px;
height: 50px;
display: block;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}
<footer>
<div class="footrow">
<div class="foot">
<div class="quarter-width">
<p style="color:#fff;">Address</p>
<hr>
<div>
Science & Technology University
<hr> Phone: 02-7458745
<hr> Email: registrar#abc.gmail.com
</div>
</div>
<div class="quarter-width">
<p style="color:#fff;">Quick Links</p>
<hr>
Link 1<br>
Link 2<br>
Link 3<br>
</div>
<div class="quarter-width">
<p style="color:#fff;">Follow Us</p>
<hr>
<div id="social2">
<div class="sc-icn2">
<img src="images/social/facebook.png" width="50px" height="50px" alt="facebook" title="fb">
</div>
<div class="sc-icn2">
<img src="images/social/twitter.png" width="50px" height="50px" alt="twitter" title="#board">
</div>
<div class="sc-icn2">
<img src="images/social/instagram2.png" width="50px" height="50px" alt="instagram" title=" Photography">
</div>
</div>
</div>
<div class="quarter-width">
<p style="color:#fff;">Report</p>
<hr>
<a style="cursor:pointer;" onclick="feedClick('bug')">Found
a Bug</a><br>
<a style="cursor:pointer;" onclick="feedClick('feed')">Feedback</a><br>
<a style="cursor:pointer;" onclick="feedClick('feature')">Request feature</a><br>
</div>
</div>
</div>
<div class="footrow2">
<div class="foot">
<div class="half-width">
<p class="foot-p">©- 2018 | All rights reserved</p>
</div>
<div class="half-width">
<p style="float:right !important;" class="foot-p">Developed & Maintained By <a style="color:orange" href="https://www.facebook.com/abc"><strong>SK Biswas</strong></a></p>
</div>
</div>
</div>
</footer>
The footer has two parts. one is within class "footrow" and another is within "footrow2". footrow will take position above footrow2. the problem is the height of the content of footrow2 class is taking different height for different pages. Is there any way to make it of a fixed height?
If you want to give any element 100% width of your page better use the vw instead of % as:
width: 10vw;
vw stands for viewport width and 10 means 100%. It will set the complete width on all devices.

Trying to align text and an icon html/css

I am trying to align an icon with some text like this:
however it comes out like this:
.percent {
float: right;
display: inline-block;
position: relative;
}
.card-icon {
float: left;
}
<div class="col-md-4">
<div class="card">
<div class="card-header" id="blue">
<p class="text-center"> Self Managed <img src="app/assets/images/star.png" alt=""> </p>
</div>
<p class="percent"> <img class="card-icon" src="app/assets/images/self.png" alt="Smiley face"> 1% </p>
EDIT ****
With the last answer provided it shows up like this:
.card-icon {float: left;margin-right:10px; }
<style type="text/css">
</style>
<div class="col-md-4">
<div class="card">
<div class="card-header" id="blue">
<p class="text-center"> Self Managed <img src="app/assets/images/star.png" alt=""> </p>
</div>
<div class = "percent">
<img class="card-icon" src="app/assets/images/self.png" alt="Smiley face">
<div class="card-txt"> 1% </div>
</div>
</div>
</div>
Try to use inline-block instead of floats:
.card-icon {
display: inline-block;
vertical-align: middle;
position: relative;
z-index: 1;
}
.card-icon:after {
content: "=";
position: absolute;
right: -16px;
top: 50%;
transform: translateY(-50%);
}
.percent .card-txt:nth-of-type(1) {
text-align: center;
}
.card-txt {
display: inline-block;
vertical-align: middle;
text-align: center;
margin-left: 24px;
}
.block {
display: block;
}
<div class="col-md-4">
<div class="card">
<div class="card-header" id="blue">
<p class="text-center"> Self Managed <img src="app/assets/images/star.png" alt=""> </p>
</div>
<div class="percent">
<img class="card-icon" src="app/assets/images/self.png" alt="Smiley face">
<div class="card-txt">
<span class="block">1%</span>
<span class="block">service tax + VAT</span>
</div>
</div>
</div>
</div>
Sometimes the best solution is an old solution. Using HTML tables allows you to control vertical height with a high level of browser support, and backwards compatibility. Using this approach also make the element responsive. Other solutions that adopt the relative/absolute position method can suffer when resizing browser window size.
table {
margin: 0 auto;
border: 1px solid blue;
}
table tr td {
padding: 10px;
width: 100px;
text-align: center;
vertical-align: middle;
position: relative;
}
table tr .number-cell {
padding-top:10px;
width: 80px;
}
table tr .number-cell .value {
margin-top: 4px;
font-size: 42px;
}
table tr .number-cell .sub-heading {
background: grey
}
table tr .equal-cell {
width: 0px;
}
table tr td img {
width: 100%;
}
<div>
<h1>MY WEBSITE</h1>
<table>
<tr>
<td class="image-cell">
<img src="https://www.fillmurray.com/100/100"/>
</td>
<td class="equal-cell">
<span class="equal">=</span>
</td>
<td class="number-cell">
<div class="value">1%</div>
<div class="sub-heading">service fee</div>
</td>
</tr>
</table>
</div>
.card-icon {float: left;position:relative;z-index:1; }
.card-icon:after {content:"=";position:relative; left:25px;}
.percent .card-txt:nth-of-type(1) {text-align:center;position:relative; left:-55px;}
.card-txt {text-align:center; width:400px;background:#ddd;}
<div class="col-md-4">
<div class="card">
<div class="card-header" id="blue">
<p class="text-center"> Self Managed <img src="app/assets/images/star.png" alt=""> </p>
</div>
<div class = "percent">
<img class="card-icon" src="app/assets/images/self.png" alt="Smiley face">
<div class="card-txt"> 1% </div>
<div class="card-txt"> service tax + VAT </div>
</div>
</div>
</div>
If you want more controle you can use flex styling. An example:
.card {
position: relative;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
width: 500px;
}
.card-header {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 10px;
background-color: blue;
color: white;
font-size: 24px;
}
.card-content {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background-color: gray;
}
.card-header > img {
position: absolute;
right: 0;
width: 50px;
height: 50px;
}
<div class="card">
<div class="card-header">
<span>Self Managed</span>
<img src="app/assets/images/star.png" alt="">
</div>
<div class="card-content">
<img class="card-icon" src="app/assets/images/self.png" alt="Smiley face">
<span>1%</span>
</div>
</div>

In-line image and h (HTML/CSS)

I want to align in-line a profile image and its username inline. Here's the code:
<div id="post">
<div class="proPic">
<img title="proPic" alt="Profile Picture" src="">
</div>
<h3>Username</h3>
<p>Text post</p>
</div>
What's the best way to do this? I'd like to see both HTML and CSS methods.
Here's a version using less code than you have already ;)
body {
font-family: arial;
}
.profile {
width: 25%;
float: right;
background: pink;
}
.profile h3 {
margin: 0;
padding: 0;
font-size: 14px;
min-height: 50px; /*Just for demo*/
}
.content {
width: 70%;
float: left;
background: #ccc;
min-height: 200px; /*Just for demo*/
}
<div class="post">
<div class="profile">
<img title="proPic" alt="Profile Picture" src="">
<h3>Username</h3>
</div>
<div class="content">
Text post
</div>
</div>