Image not aligning properly - html

What I want to achieve is something like this below
And what I am getting is something where there's too much of a gap between the image and the green border.
how do I make it look like the previous image above.
Here's the link to my codepen - codepen link
Here's the code:
.container {
text-align: center;
width: 80%;
}
.first {
background: rgb(0, 30, 58);
color: white;
}
.span1,
.span2 {
font-size: 36px;
font-weight: bold;
}
.span1 {
color: rgb(72, 174, 137);
}
[type="text"] {
border-radius: 25px;
padding-left: 5px;
}
[type="submit"] {
color: white;
background-color: rgb(72, 174, 137);
border-radius: 25px;
position: relative;
margin-left: -25px;
}
.use {
height: 85%;
margin: 0 auto;
}
.box {
border: 3px solid rgb(72, 174, 137);
width: 55%;
margin: 0 auto;
max-height: 210px;
}
.box .img-responsive {
margin-top: -20px;
}
.para {
text-align: left;
margin-right: 0;
padding-right: 0;
padding-top: 15px;
}
.para strong {
font-weight: 900;
font-size: 16px;
}
.second {
margin-bottom: 30px;
border: 1px solid green;
width: 10%;
}
.threebox {
width: 90%;
margin: 0 auto;
padding-left: 70px;
}
.col-lg-4 {
height: 40%;
}
.col-lg-4 > p {
background-color: white;
border: 2px solid white;
border-top-color: green;
width: 200px;
height: 160px;
box-shadow: 10px 10px 15px;
}
.positions {
margin-top: 60px;
position: relative;
margin-bottom: -50px;
z-index: 2;
}
.positions > h1 {
font-size: 30px;
font-weight: bold;
}
.spanf {
font-size: 18px;
font-weight: bold;
}
.features {
text-align: center;
padding-bottom: 40px;
width: 100%;
margin: 0 auto;
background-color: rgb(242, 243, 245);
height: 1500px;
z-index: 1;
padding-top: 120px;
margin-bottom: 0;
}
.features .row {
border: 2px solid red;
width: 65%;
margin: 0 auto;
}
.features .row p {
text-align: left;
padding-left: 20px;
}
.features button {
border-radius: 20px;
}
.features .row {
margin-top: 40px;
}
.features img {
width: 98%;
height: 98%;
}
.features .row .col-lg-6 {
padding-right: 15px;
padding-left: 2px;
}
.imgright {
position: relative;
border: 3px solid rgb(72, 174, 137);
top: 5%;
width: 40%;
padding-bottom: 0px;
padding-right: 2px;
padding-left: 0;
margin-left: 20px;
margin-top: 20px;
}
.img2 {
position: relative;
top: -25px;
left: -20px;
padding-bottom: 10px;
}
.imgleft {
position: relative;
border: 3px solid rgb(72, 174, 137);
width: 40%;
top: 5%;
margin-left: 10px;
margin-top: 20px;
}
.img3 {
position: relative;
top: -20px;
padding-bottom: 10px;
left: 40px;
}
.pillars {
background-color: rgb(72, 174, 137);
height: 350px;
top: 0;
}

This is the CSS after the changes and rest of your CSS will be there.
.features img {
/* width: 98%; */
/* height: 98%; */
left: 12px;
top: -12px;
box-shadow: -2px 2px 9px;
}
.features .row .col-lg-6 {
/* padding-right: 15px; */
/* padding-left: 2px; */
}
.img2 {
position: relative;
/* padding-bottom: 10px; */
}
.imgleft {
position: relative;
border: 3px solid rgb(72, 174, 137);
width: 40%;
top: 5%;
margin-left: 10px;
margin-top: 20px;
padding: 0;
}
.img3 {
position: relative;
left:30px;
/* top:-20px; */
/* padding-bottom: 10px; */
}

here u already defined .img2 and .img3 classes, your result was effecting by these classes just remove those classes then it works fine, check my snippet
.box .img-responsive {
margin-top: -20px;
} and remove margin-top from here
.container {
text-align: center;
width: 80%;
}
.first {
background: rgb(0, 30, 58);
color: white;
}
.span1,
.span2 {
font-size: 36px;
font-weight: bold;
}
.span1 {
color: rgb(72, 174, 137);
}
[type="text"] {
border-radius: 25px;
padding-left: 5px;
}
[type="submit"] {
color: white;
background-color: rgb(72, 174, 137);
border-radius: 25px;
position: relative;
margin-left: -25px;
}
.use {
height: 85%;
margin: 0 auto;
}
.box {
border: 3px solid rgb(72, 174, 137);
width: 55%;
margin: 0 auto;
max-height: 210px;
}
.box .img-responsive {
margin-top: -20px;
}
.para {
text-align: left;
margin-right: 0;
padding-right: 0;
padding-top: 15px;
}
.para strong {
font-weight: 900;
font-size: 16px;
}
.second {
margin-bottom: 30px;
border: 1px solid green;
width: 10%;
}
.threebox {
width: 90%;
margin: 0 auto;
padding-left: 70px;
}
.col-lg-4 {
height: 40%;
}
.col-lg-4 > p {
background-color: white;
border: 2px solid white;
border-top-color: green;
width: 200px;
height: 160px;
box-shadow: 10px 10px 15px;
}
.positions {
margin-top: 60px;
position: relative;
margin-bottom: -50px;
z-index: 2;
}
.positions > h1 {
font-size: 30px;
font-weight: bold;
}
.spanf {
font-size: 18px;
font-weight: bold;
}
.features {
text-align: center;
padding-bottom: 40px;
width: 100%;
margin: 0 auto;
background-color: rgb(242, 243, 245);
height: 1500px;
z-index: 1;
padding-top: 120px;
margin-bottom: 0;
}
.features .row {
border: 2px solid red;
width: 65%;
margin: 0 auto;
}
.features .row p {
text-align: left;
padding-left: 20px;
}
.features button {
border-radius: 20px;
}
.features .row {
margin-top: 40px;
}
.features img {
width: 98%;
height: 98%;
}
.features .row .col-lg-6 {
padding-right: 15px;
padding-left: 2px;
}
.imgright {
position: relative;
border: 3px solid rgb(72, 174, 137);
top: 5%;
width: 40%;
padding-bottom: 0px;
padding-right: 2px;
padding-left: 0;
margin-left: 20px;
margin-top: 20px;
}
.imgleft {
position: relative;
border: 3px solid rgb(72, 174, 137);
width: 40%;
top: 5%;
margin-left: 10px;
margin-top: 20px;
}
.pillars {
background-color: rgb(72, 174, 137);
height: 350px;
top: 0;
}
<div class="container">
<div class="first">
<p>CONVERSIFIC</p>
<p><span class="span1">The 1st</span><br>Business Intelligence Platform<br><span class="span2">for Shopify</span></p>
<p>We show you how to grow your revenue<br><span class="span3">-all you have to do is take action</span></p>
<form>
<input type="text" placeholder="enter your email" name="email">
<input type="submit" name="submit" value="Add me to Beta">
</form>
<p>Join our beta today,be the first to get access to Conversific</p>
</div><!--first div ends -->
<div class="use">
<h1>Why use Conversicif?</h1>
<hr class="firsth">
<div class="box row">
<div class="col-lg-6 images">
<img class="img-responsive " src="http://res.cloudinary.com/whizzy/image/upload/v1473309440/graph.jpg" alt="graph">
</div>
<div class="col-lg-6 para">
<p><strong>Conversific helps you make intelligent decisions to grow your business</strong><br>
There are plentfy of platforms that make it easy to capture data and analytics about your ecommerce site.But when it comes to understanding the data you've captured, it's not always clear what's important and where to make changes.</p>
</div>
</div><!--box div ends -->
<div class="positions">
<h1>How does Conversific work?</h1>
<p>Say goodbye to gathering reports and analyzing data and head straight to decision making </p>
<hr class="second">
<div class="threebox row">
<div class="col-lg-4"><p>Conversific is installed onto your ecommerce store with just one click from your shopify store</p></div>
<div class="col-lg-4"><p>After the installation you just need to install google analytics</p></div>
<div class="col-lg-4"><p>Immediately after you have signed in you see a comprehensive reports overview</p></div>
</div><!--threebox row ends -->
</div><!-- positions div ends-->
</div><!--use div ends -->
<div class="features">
<h1> Features you'll love</h1>
<p>These are the features you are going to love no matter what<br>
So, is this the end of the paragraph or what or are you gonna keep<br>
typing till your fingers bleed??</p>
<div class="row">
<div class="col-lg-6">
<p>ECOMMERCE FOCUS<br><span class="spanf">Decision Focused Dashboards To Supercharge Your Ecommerce Business</span><br>
There are plenty of platforms that make it easy to capture data and analytics about your ecommerce site. But when it comes to understanding the data you've captured. It's not always clear what's important and where to make changes.<br>
<button>Join Now</button></p>
</div>
<div class="col-lg-6 imgright">
<img class="img-responsive img2 " src="http://res.cloudinary.com/whizzy/image/upload/v1473309440/graph.jpg" alt="graph">
</div>
</div><!-- row ends -->
<div class="row">
<div class="col-lg-6 imgleft">
<img class="img-responsive img3" src="http://res.cloudinary.com/whizzy/image/upload/v1473309440/graph.jpg" alt="graph">
</div>
<div class="col-lg-6"><p>EASY TO UNDERSTAND<br><span class="spanf">Optimize Your Product & Category<br> Performance</span><br>
There are plenty of platforms that make it easy to capture data and analytics about your ecommerce site. But when it comes to understanding the data you've captured. It's not always clear what's important and where to make changes.<br>
<button>Join Now</button></p></div>
</div><!-- row ends -->
<div class="row">
<div class="col-lg-6"><p>INCREASE REVENUE<br><span class="spanf">Turbo Boost Your marketing and Find<br> Top Performing Marketing Channels</span><br>
See which marketing channels are the most effective for your business<br>and maximize your return on investment<br>
<button>Join Now</button></p></div>
<div class="col-lg-6 imgright">
<img class="img-responsive img2" src="http://res.cloudinary.com/whizzy/image/upload/v1473309440/graph.jpg" alt="graph">
</div>
</div><!-- row ends -->
<div class="row">
<div class="col-lg-6 imgleft">
<img class="img-responsive img3" src="http://res.cloudinary.com/whizzy/image/upload/v1473309440/graph.jpg" alt="graph">
</div>
<div class="col-lg-6"><p>ECOMMERCE FOCUS<br><span class="spanf">Decision Focused Dashboards To<br> Supercharge Your Ecommerce Business</span><br>
There are plenty of platforms that make it easy to capture data and analytics about your ecommerce site. But when it comes to understanding the data you've captured. It's not always clear what's important and where to make changes.<br>
<button>Join Now</button></p></div>
</div><!-- row ends -->
</div><!-- features div ends -->
<div class="pillars">
<h1>The 4 pillars of Conversific</h1>
<p>Stop wasting time on your decision making process, increase revenue and reduce costs </p>
<hr>
</div><!-- pillars div ends -->
<div class="team"></div>
<div class="end"></div>
</div><!-- container div ends -->

Related

Color changes when selected as opposed to when hovered over

a {
text-decoration: none;
}
.header {
position: relative;
top: 1px;
left: 589px;
padding-top: 20px;
padding-bottom: 10px;
}
.subtitle {
position: relative;
right: 26px;
letter-spacing: 2px;
padding-top: 5px;
font-size: 21px;
font-family: arial;
font-weight: bold;
color: #6b6b6b;
text-shadow: 0px 0 #6b6b6b, 0 0px #6b6b6b, 2px 0 #6b6b6b, 0 0px #6b6b6b;
}
/* Menu*/
nav {
position: relative;
left: 210px;
height: 70px;
border-radius: 60px;
background: #dc67e9;
width: 1000px;
}
ul {
margin-left: 17%;
}
ul li {
display: inline-block;
line-height: 80px
}
ul li a {
text-decoration: none;
font-family: 'Coiny', cursive;
font-size: 19px;
color: white;
padding: 0 20px
}
ul li a:hover {
color: black;
}
.bannerimage {
margin-left: 5px;
margin-top: 4px;
}
.banner {
margin-top: 4px;
background-color: #dc67e9;
width: 100%;
height: 589px;
}
.bannerpromo1 {
position: relative;
bottom: 500px;
margin-left: 60px;
font-family: 'Lobster', cursive;
color: black;
text-shadow: -3px 0 white, 0 3px white, 3px 0 white, 0 -3px white;
font-size: 70px;
}
.bannerpromo2 {
position: relative;
bottom: 470px;
margin-left: -780px;
font-family: 'Lobster', cursive;
color: #585656;
text-shadow: -3px 0 white, 0 3px white, 3px 0 white, 0 -3px white;
font-size: 50px;
text-align: center;
}
.subscribebanner {
width: 250px;
height: 50px;
background-color: #dc67e9;
position: relative;
left: 190px;
bottom: 430px;
border: 4px solid white;
}
.subscribebannertext {
margin-left: 30px;
margin-top: 15px;
font-family: 'Coiny', cursive;
word-spacing: 2px;
font-size: 30px;
}
.howitworks {
font-size: 60px;
font-family: 'Lobster', cursive;
text-shadow: #a8a8a8 4px 6px;
margin-top: 50px;
position: relative;
left: 555px;
}
.subheaderbox1 {
position: relative;
margin-top: 20px;
right: 315px;
border-radius: 25px;
background: #adcae1;
width: 200px;
height: 100px;
}
.subheaderbox2 {
position: relative;
bottom: 100px;
left: 65px;
border-radius: 25px;
background: #adcae1;
width: 200px;
height: 100px;
}
.subheaderbox3 {
position: relative;
bottom: 200px;
left: 450px;
border-radius: 25px;
background: #adcae1;
width: 200px;
height: 100px;
}
.subheaders {
position: relative;
bottom: 275px;
font-size: 40px;
margin-left: -265px;
word-spacing: 250px;
letter-spacing: 3px;
color: white;
}
.box1 {
position: relative;
right: 370px;
bottom: 225px;
border-radius: 7px;
border: 5px dotted #dc67e9;
}
.box2 {
position: relative;
right: -15px;
bottom: 500px;
border-radius: 7px;
border: 5px dotted #dc67e9;
}
.box3 {
position: relative;
right: -405px;
bottom: 780px;
border-radius: 7px;
border: 5px dotted #dc67e9;
}
.step1 {
position: relative;
right: 932px;
bottom: 219px;
color: #666666;
font-size: 30px;
text-align: center;
}
.step2 {
position: relative;
right: 546px;
bottom: 493px;
color: #666666;
font-size: 30px;
text-align: center;
}
.step3 {
position: relative;
right: 153px;
bottom: 766px;
color: #666666;
font-size: 30px;
text-align: center;
}
.section1 {
position: relative;
margin-top: 20px;
bottom: 660px;
background-color: #adcae1;
margin-left: -570px;
width: 720px;
height: 500px;
text-align: center;
color: white;
}
.section2 {
position: relative;
left: 149px;
bottom: 660px;
background-color: #adcae1;
width: 720px;
height: 500px;
text-align: center;
color: white;
}
.section1title {
padding-top: 80px;
font-size: 70px;
}
.section1text {
font-size: 40px;
text-shadow: none;
color: #f0f0f0;
}
.section2title {
padding-top: 100px;
font-size: 70px;
}
.section2text {
font-size: 35px;
text-shadow: none;
color: #f0f0f0;
padding-left: 1px;
}
.imgsect1 {
margin-left: 148px;
position: relative;
bottom: 1660px
}
.imgsect2 {
position: relative;
bottom: 1668px;
right: 571px;
}
<!DOCTYPE html>
<html>
<head>
<title>SweetVie-Home-Page</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="indexstyle.css">
<link href="https://fonts.googleapis.com/css?family=Bungee+Shade|Lobster" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Coiny" rel="stylesheet">
<link rel="stylesheet" href="indexstyle.css">
<style>
a {
text-decoration: none;
}
</style>
</head>
<body>
<div class="topfiller"></div>
<div class="header">
<img src="images/logo.jpg" height="90" alt="SweetVieLogo">
<h2 class="subtitle">Vegan Baking Made Easy</h2>
</div>
<nav>
<ul>
<li>HOME</li>
<li>ABOUT US</li>
<li>COMMUNITY</li>
<li>FAQ</li>
<li>SUBSCRIBE</li>
</ul>
</nav>
<div class="banner">
<img class="bannerimage" src="images/mainpageimage.jpg" width="1414px" height="580px" alt="homepagebanner">
<h2 class="bannerpromo1">Premium Packaged <br>Dessert Baking Kits</h2>
<h2 class="bannerpromo2">High-quality,<br> organic and<br> vegan ingredients </h2>
<div class="subscribebanner">
<h3 class="subscribebannertext"> SUBSCRIBE</h3>
</div>
</div>
<div class="howitworks">
<h1>How It Works</h1>
<div class="subheaderbox1"></div>
<div class="subheaderbox2"></div>
<div class="subheaderbox3"></div>
<div class="subheaders">
<h2>Click Prepare Enjoy</h2>
</div>
<div>
<img class="box1" src="images/howitworks1.jpg" height="200" width="300" alt="step1">
</div>
<h3 class="step1">Select one of the three<br>subscription options</h3>
<div>
<img class="box2" src="images/howitworks2.jpg" height="200" width="300" alt="step2">
</div>
<h3 class="step2">Get involved and play<br>with your food</h3>
<div>
<img class="box3" src="images/howitworks3.jpg" height="200" width="300" alt="step3">
</div>
<h3 class="step3">Share or indulge in your<br>decadent and delicious treat</h3>
<div class="section1">
<h2 class="section1title">Food Time<br> Family Time</h2>
<br>
<p class="section1text">Timeless family fun,<br> sharing special treats with the <br> special people you love </p>
</div>
<div class="section2">
<h2 class="section2title">The Next Step</h2>
<br>
<p class="section2text">Health and desserts don't really<br> go together, with the exception of<br> SweetVie's sweets. Vegan desserts are the<br> baby steps you need for the best kind<br> of progress</p>
</div>
<div class="imgsect1">
<img src="images/homepagesection1.jpg" width="720px" height="500px" alt="Food Time Family Time.jpg">
</div>
<div class="imgsect2">
<img src="images/homepagesection2.jpg" width="720px" height="500px" alt="The Next Step.jpg">
</div>
</body>
</html>
I'm currently making a website for a school project that requires a menu bar. The menu bar changed to black whenever the cursor hovered over it previously, but recently stopped and now only changes color when it is selected/clicked.
I'm very new to html and css so I know my syntax or method of positioning my elements/divs may be poor.
But if there are any tips or guidance on what I should do to fix this problem, that would be great.
As pointed out in the comments, the div with class bannerpromo2 is getting in front of the menu, blocking hover and clicks.
As for the strange behavior you are getting when "inspecting", there is no magic there. Since bannerpromo2 is positioned relative to the bottom (it has bottom: 470px;), the position could be changing when you "inspect" it, because the developer panel opens from the bottom of your browser window, thus changing the bottom property of bannerpromo2.
If you want to see all of that in play, give bannerpromo2 a background color:
.bannerpromo2 {
background-color: green;
/* ...other props */
}

HTML5/CSS3 - Float issue

I have a "posts__box" ("Davi Jesus" section) that is floating far to the right even with a "posts__box--left" class ("float: left"). HTML is fine, CSS is fine, I'm freaking out 'cause I can't understand why the heck this is happening.
btw: "revista" means "magazine" and it's my first time trying to apply BEM methodoly. I'm a newbie webdesigner.
Images:
.posts {
width: 100%;
}
.container {
float: left;
width: 80%;
height: 1400px;
margin: 0 135px;
padding: 0;
background: #ffffff;
}
.box--btn {
margin-top: 10px;
border: 1.5px solid black;
box-shadow: 2px 2px 2px dimgray;
}
.posts__box {
margin-top: 40px;
margin-left: 20px;
width: 30%;
}
.box--title {
text-align: center;
}
.box--img {
width: 100%;
box-shadow: 3px 3px 3px Dimgray;
}
.box--text {
padding: 5px;
}
.box--author {
float: right;
width: 46%;
height: 50px;
}
.box--author--text {
margin-top: 10px;
margin-left: 6px;
}
.box--continue {
float: left;
width: 46%;
height: 50px;
}
.box--continue--text {
margin-top: 12px;
margin-left: 7px;
}
.posts__btns {
float: left;
margin-top: 20px;
width: 100%;
height: 200px;
}
/* MODIFIERS */
.revista__posts--height {
height: 3000px;
}
/* posts */
.title--red {
color: rgba(233, 26, 26, 1);
}
.title--size-small {
font-size: 30px;
text-shadow: 1.5px 1.5px black;
}
.title--size-large {
font-size: 60px;
text-shadow: 3px 3px black;
}
.box--btn--red {
background: rgba(233, 26, 26, 1);
}
.continue--white {
color: #ffffff;
text-shadow: 1.5px 1.5px black;
}
.box--btn--black {
background: #212121;
}
.author--white {
color: #ffffff;
text-shadow: 2px 2px black;
}
.posts__box--left {
float: left;
}
.posts__box--right {
float: right;
}
.posts__box--margin--fix--left {
margin-top: 10px;
margin-left: 40px;
}
.posts__box--margin--fix--top {
margin-top: 34px;
margin-left: 40px;
}
.posts__btns--left {
float: left;
margin-left: 20px;
}
.posts__btns--right {
float: right;
margin-right: 20px;
}
/* revista */
.container__border {
border-top: 4px solid black;
border-left: 4px solid black;
border-right: 4px solid black;
}
.revista__container--height {
height: 4800px;
}
<article class="posts">
<section class="container revista__container--height container__border">
<!-- davi jesus -->
<section class="posts__box posts__box--left">
<div class="box--title">
<a class="title--red --hover" href="..\revista\artistas\davi-jesus.html">
<h1 class="title--size-small --hover--darkred">Davi de Jesus do Nascimento:<br> corpo de rio</h1>
</a>
</div>
<div>
<a href="..\revista\artistas\davi-jesus.html">
<img class="box--img" src="..\_img\posts\davi-de-jesus\instax\6.png" alt="">
</a>
</div>
<div class="box--continue box--btn box--btn--red">
<a class="--hover" href="..\revista\artistas\davi-jesus.html">
<h5 class="box--continue--text continue--white -font--very-small --hover--dimgray">CONTINUAR A LEITURA</h5>
</a>
</div>
<div class="box--author box--btn box--btn--black">
<a class="--hover" href="..\revista\artistas\daniel-jesus.html">
<h2 class="box--author--text author--white -font--small --hover--dimgray">Davi Jesus</h2>
</a>
</div>
</section>
I just fixed it with a simple "clear: left" class. I guess it was just some weird bug or something like that. If someone has a different explanation and could share with us, I would appreciate. Thanks!

Making an Image Dynamic

I have 2 problems.
I have 2 images at the bottom of my page, and when the browser size shrinks, the images don't resize and get cut off, I have tried have tried to use width: 100% and height: auto. I have tried a media query I found, but nothing seems to be working, I'm pretty new to HTML and CSS so maybe its a problem with my HTML code, I will post it to the bottom for you guys to check out.
Second problem is, I have managed to have my footer element always stick to the bottom of the page regardless of the height of the page, however when the browser size shrinks, the footer is transparent and lies on top of the images, which is obviously ugly. I want the footer to always remain a certain distance away from all other elements and stick to the bottom.
I hope you can help, Thanks :)
body {
font-family: Rajdhani;
color: white;
width: 100%;
height: 100%;
}
/* ============== NAV BAR =================*/
#media (max-width: 992px) {
.navbar-collapse li a {
color: black;
padding: 300px;
}
}
.nav>li>a:focus,
.nav>li>a:hover {
background-color: transparent !important;
color: #CCCCCC;
border-bottom: 3px solid #FFFFFF;
padding-bottom: 5px;
}
.dropdown-menu li,
.dropdown-menu a {
padding: 5px 0px 5px 0px;
margin: 0px;
color: white;
background-color: white;
}
.logo {
width: 7em;
}
.navbar {
font-family: Rajdhani;
}
.collapse .navbar-collapse {
background: black;
}
.navbar-toggle .icon-bar {
background-color: #fff;
margin-top: 5.5em;
}
li a {
color: white;
margin-top: 2.5em;
font-size: 1.5em;
}
#divider1 {
padding: 0px;
margin: 0px;
}
#divider2 {
padding: 0px;
margin: 0px;
}
/* ============== SLIDE 1 =================*/
#slide1 {
background: url(dojo.jpg) 50% 0 no-repeat fixed;
background-size: cover;
height: 450px;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
min-height: 100%;
position: relative;
}
/* ============== SLIDE 2 =================*/
#slide2 {
background-color: #fff;
color: #333333;
height: 1150px;
margin: 0 auto;
overflow: hidden;
padding-top: 15px;
position: relative;
padding-bottom: 200px;
}
.headers h1 {
color: white;
display: block;
margin-top: 90px;
font-family: Rajdhani;
text-align: center;
font-size: 80px;
}
.headers2 {
text-align: center;
font-family: Rajdhani;
}
hr {
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
width: 85%;
}
.aboutcontent {
font-family: Rajdhani;
margin: 0px 100px 0px 100px;
font-size: 20px;
text-align: center;
}
#aboutimages {
text-align: center;
display: flex;
justify-content: center;
}
.aboutimages1 {
width: 300px;
height: 375px;
margin: 40px 10px 0px 0px;
}
.aboutimages2 {
width: 300px;
height: 375px;
margin: 40px 0px 0px 10px;
}
/* ============== CONTACT BAR =================*/
#contact {
position: absolute;
font-family: Rajdhani;
font-size: 1em;
text-align: center;
bottom: 0;
width: 100%;
height: 260px;
}
#info {
width: 100%;
}
.logo2 {
width: 7em;
padding-bottom: 0.5em;
}
<div id="slide2">
<div class="headers2">
<h2><strong>GOSPORT & FAREHAM'S HOME OF CHAMPIONS!</strong></h2>
<hr>
</div>
<div class="aboutcontent">
<p>CONTENT</p>
<p>CONTENT</p>
</div>
<div id="aboutimages">
<img class="aboutimages1" src="https://www.gettyimages.ie/gi-resources/images/Homepage/Hero/UK/CMS_Creative_164657191_Kingfisher.jpg">
<img class="aboutimages2" src="https://listaka.com/wp-content/uploads/2015/07/baby-boy-wearing-hat.jpg">
</div>
<div id="contact">
<div id="info">
<footer>
<hr>
<img class="logo2" src="#"><br> CONTACT INFO <br> CONTACT INFO <br> CONTACT INFO <br> CONTACT INFO <br>
<i class="fab fa-facebook-square fa-2x"></i>
<i class="fab fa-instagram fa-2x"></i>
<i class="fas fa-envelope fa-2x"></i>
</footer>
</div>
</div>
</div>
I apologise for the mass of code, im not quite sure what it is thats wrong, so thought id try provide enough info. Thanks guys ::)
It will cut off due to the following reason
Parent Property - overflow:hidden;
Child Property - width:300px; (It's in px)
Pixel value will force your image to stay rigid and your hidden overflow will not let your image to grow outside the container.
Solution:
Let's keep overflow:hidden; as it is but add media-query to it
Variations you can try with media-query
As I have shown, you can get 2 images one over another
You can remove px value from your width, and change it with % value
body {
font-family: Rajdhani;
color: white;
/* width: 100%; */
height: 100%;
}
/* ============== NAV BAR =================*/
#media (max-width: 992px) {
.navbar-collapse li a {
color: black;
padding: 300px;
}
}
.nav>li>a:focus,
.nav>li>a:hover {
background-color: transparent !important;
color: #CCCCCC;
border-bottom: 3px solid #FFFFFF;
padding-bottom: 5px;
}
.dropdown-menu li,
.dropdown-menu a {
padding: 5px 0px 5px 0px;
margin: 0px;
color: white;
background-color: white;
}
.logo {
width: 7em;
}
.navbar {
font-family: Rajdhani;
}
.collapse .navbar-collapse {
background: black;
}
.navbar-toggle .icon-bar {
background-color: #fff;
margin-top: 5.5em;
}
li a {
color: white;
margin-top: 2.5em;
font-size: 1.5em;
}
#divider1 {
padding: 0px;
margin: 0px;
}
#divider2 {
padding: 0px;
margin: 0px;
}
/* ============== SLIDE 1 =================*/
#slide1 {
background: url(dojo.jpg) 50% 0 no-repeat fixed;
background-size: cover;
height: 450px;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
min-height: 100%;
position: relative;
}
/* ============== SLIDE 2 =================*/
#slide2 {
background-color: #fff;
color: #333333;
height: 1150px;
margin: 0 auto;
overflow: hidden;
padding-top: 15px;
position: relative;
padding-bottom: 200px;
}
.headers h1 {
color: white;
display: block;
margin-top: 90px;
font-family: Rajdhani;
text-align: center;
font-size: 80px;
}
.headers2 {
text-align: center;
font-family: Rajdhani;
}
hr {
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
width: 85%;
}
.aboutcontent {
font-family: Rajdhani;
margin: 0px 100px 0px 100px;
font-size: 20px;
text-align: center;
}
#aboutimages {
text-align: center;
display: flex;
justify-content: center;
}
.aboutimages1 {
width: 300px;
height: 375px;
margin: 40px 10px 0px 0px;
}
.aboutimages2 {
width: 300px;
height: 375px;
margin: 40px 0px 0px 10px;
}
/* ============== CONTACT BAR =================*/
#contact {
position: absolute;
font-family: Rajdhani;
font-size: 1em;
text-align: center;
bottom: 0;
width: 100%;
height: 260px;
}
#info {
width: 100%;
}
.logo2 {
width: 7em;
padding-bottom: 0.5em;
}
#media screen and (max-width: 621px) {
#aboutimages {
flex-direction: column;
}
#info {
margin-top: 60px;
}
.aboutimages1 {
margin: auto;
}
.aboutimages2 {
margin: auto;
}
}
<div id="slide2">
<div class="headers2">
<h2><strong>GOSPORT & FAREHAM'S HOME OF CHAMPIONS!</strong></h2>
<hr>
</div>
<div class="aboutcontent">
<p>CONTENT</p>
<p>CONTENT</p>
</div>
<div id="aboutimages">
<img class="aboutimages1" src="https://www.gettyimages.ie/gi-resources/images/Homepage/Hero/UK/CMS_Creative_164657191_Kingfisher.jpg">
<img class="aboutimages2" src="https://listaka.com/wp-content/uploads/2015/07/baby-boy-wearing-hat.jpg">
</div>
<div id="contact">
<div id="info">
<footer>
<hr>
<img class="logo2" src="#"><br> CONTACT INFO <br> CONTACT INFO <br> CONTACT INFO <br> CONTACT INFO <br>
<i class="fab fa-facebook-square fa-2x"></i>
<i class="fab fa-instagram fa-2x"></i>
<i class="fas fa-envelope fa-2x"></i>
</footer>
</div>
</div>
</div>

Whole layout messed up with relative width

I have following html for my site:
Edit: https://jsfiddle.net/3v66fv3u/1/ for the static site
and my approach of making the site responsive: https://jsfiddle.net/wba321bm/
<!DOCTYPE html>
<html>
<head>
<link href="custom.css" rel="stylesheet">
</head>
<body>
<h1 class="title">Headline</h1>
<div class="wrapper">
<div class="left">
<div class="top">
<img id="img_1" src="img_1.png">
</div>
<div class="bottom">
<img id="img_3" src="img_3.png">
</div>
</div>
<div class="middle">
<div class="about-text">
<h3>small headline</h3>
<p>actually a lot of text</p>
</div>
</div>
<div class="right">
<div class="top">
<img id="img_2" src="img_2.png">
</div>
<div class="bottom">
<img id="img_4" src="img_4.png">
</div>
</div>
</div>
<img class="banner" src="banner.png"/>
</body>
</html>
And this is my current css file:
html {
font-family: "Verdana", Geneva, sans-serif;
color: white;
}
body {
margin: auto;
background-color: black;
width: 1150px;
}
hr {
border-top: 1px dotted black;
}
.title {
text-align: center;
padding-bottom: 20px;
}
.wrapper {
margin: auto;
}
.left {
float: left;
}
.middle {
height: 597px;
width: 550px;
float: left;
border-top: 1px solid white;
border-bottom: 1px solid white;
box-shadow: inset 0px 0px 20px 0px rgba(0,0,0,1);
margin-top: -4px;
}
.about-text {
margin-left: 25px;
margin-right: 25px;
}
.right {
float: left;
}
.gallery {
padding-top: 100px;
width: 100%;
text-align: center;
}
img {
height: 300px;
transition: 0.5s ease;
backface-visibility: hidden;
/* inline-block fügt standardmäßig 4px Padding hinzu
das muss nun wieder subtrahiert werden. */
margin-top: -4px;
}
img:hover {
opacity: 0.5;
}
#img_1 {
border-top-left-radius: 30px;
}
#img_2 {
border-top-right-radius: 30px;
}
#img_3 {
border-bottom-left-radius: 30px;
}
#img_4 {
border-bottom-right-radius: 30px;
}
/* 827 x 178 */
.banner {
width: 410px;
height: 90px;
position: absolute;
right: 0px;
bottom: 0px;
}
The website currently looks like this (with static layout):
Now I want to go away from the fixed layout and want to make the website responsive. However, when I give the fields a relative width the whole layout gets messed up...
This is the css I tried to use to achieve the responsive layout:
html, body {
font-family: "Verdana", Geneva, sans-serif;
color: white;
background-color: black;
height: 100%;
}
hr {
border-top: 1px dotted black;
}
.title {
text-align: center;
padding-bottom: 20px;
}
.wrapper {
border: 1px solid white;
margin: auto;
width: 80%;
}
.left {
float: left;
}
.middle {
width: 40%;
height: auto;
float: left;
border-top: 1px solid white;
border-bottom: 1px solid white;
box-shadow: inset 0px 0px 20px 0px rgba(0,0,0,1);
margin-top: -4px;
}
.about-text {
margin-left: 25px;
margin-right: 25px;
}
.right {
float: left;
}
.gallery {
padding-top: 100px;
width: 100%;
text-align: center;
}
img {
width: 40%;
height: auto;
transition: 0.5s ease;
backface-visibility: hidden;
/* inline-block fügt standardmäßig 4px Padding hinzu
das muss nun wieder subtrahiert werden. */
margin-top: -4px;
}
img:hover {
opacity: 0.5;
}
#img_1 {
border-top-left-radius: 30px;
}
#img_2 {
border-top-right-radius: 30px;
}
#img_3 {
border-bottom-left-radius: 30px;
}
#img_4 {
border-bottom-right-radius: 30px;
}
/* 827 x 178 */
.banner {
width: 20%;
height: 10%;
position: absolute;
right: 0px;
bottom: 0px;
}
It's a matter of WHICH elements get the percentage value. In my adaptation of your fiddle, I assigned width: 30% to .left and right (which are the containers for the images) and made the image width 100% to span the whole width of their containers.
See here: https://jsfiddle.net/35n4dxqn/1/
well, when you give a or a division relative attribute it will be placed relative or according to the previous div i.e. it will not be independent from other divisions.
the solution if you want to make it responsive one forward and efficient way is to use Grid System (Bootstrap class).

how to make a span not show the excess amount of text

I've got the following css element. the CSS is as following
.bill-item {
width: 253px;
height: 60px;
background-color: white;
border: 1px solid #dadada;
border-radius: 6px;
margin-left: 22px;
margin-top: 15px;
margin-bottom: 15px;
}
.item-drop-point {
height: 40px;
width: 253px;
border: 1px dashed #dadada;
text-align: center;
background-color: white;
border-radius: 6px;
margin-left: 22px;
margin-top: 15px;
margin-bottom: 15px;
}
.item-drop-point span {
color: #dadada;
vertical-align: -10px;
}
.bill-item-img {
height: 60.4px;
width: 60px;
float: left;
border-radius: 5px;
background-image: url(../images/bill_item_img.jpg);
background-repeat: no-repeat;
background-size: cover;
}
.bill-item-description {
width: 148px;
float: left;
height: 100%;
}
.bill-item-price {
float: left;
padding: 8px 0px 0px 7px;
width: 107px;
height: 25px;
font-family: MyriadProReg;
}
.bill-item-amount {
float: right;
padding: 8px 0px 0px 7px;
width: 25px;
height: 22px;
border-left: 1px solid rgb(230, 230, 230);
}
.bill-amount-selection {
width: 44.9px;
height: 100%;
float: right;
background-image: url(../images/item_amount_selection_bg.jpg);
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.amount-increase {
height: 50%;
width: 100%;
background-image: url(../images/item_amount_inc.jpg);
background-position: center center;
background-repeat: no-repeat;
display: block;
}
.amount-decrease {
height: 50%;
width: 100%;
background-image: url(../images/item_amount_dec.jpg);
background-position: center center;
background-repeat: no-repeat;
display: block;
}
.bill-item-name {
padding-top: 5px;
border-bottom: 1px solid rgb(230, 230, 230);
height: 25px;
font-family: MyriadProReg;
}
.bill-item-name-left {
float: left;
padding-left: 6px;
padding-right: 5px;
padding-top: 4px;
font-family: MyriadProReg;
font-weight: normal;
font-size: 14px;
}
.bill-item-name-right {
float: right;
padding-top: 3px;
color: #878787;
font-family: MyriadProReg;
font-weight: 400;
}
I load text using an ajax post so some times I get more characters that I can show in the element. I hope you can get an idea from the following image.
The div hierarchy is following.
<div class="bill-item">
<!-- Item image -->
<div class="bill-item-img"></div>
<!-- Item description -->
<div class="bill-item-description">
<div class="bill-item-name">
<!-- Item Name -->
<p class="bill-item-name-left">Normal Cofee</p>
<!-- Item Price -->
<p class="bill-item-name-right">170.00</p>
<div class="clear"></div>
</div>
<!-- Total item price -->
<div class="bill-item-price">
<span>170.00</span>
</div>
<!-- Item Quantity -->
<div class="bill-item-amount">
<span>1</span>
</div>
</div>
<!-- Increas & Decrease item Quantity -->
<div class="bill-amount-selection">
<a class="amount-increase" href="#"></a>
<a class="amount-decrease" href="#"></a>
</div>
</div>
How can I fix this issue using CSS.. please help me!
Posting this as an answer to show the changes on the CSS class bill-item-name-left, did you tried something like this ?
.bill-item-name-left {
float: left;
padding-left: 6px;
padding-right: 5px;
padding-top: 4px;
font-family: MyriadProReg;
font-weight: normal;
font-size: 14px;
white-space: nowrap;
overflow:hidden;
}
If that does the trick, you should check the value you can set on the overflow or even use the text overflow property, more info : http://www.w3schools.com/cssref/css3_pr_text-overflow.asp