aligning 2 divs next to each other - html

I have 2 section on a home page, both with a picture and some text. I want to get the picture and the text of the top section next to each other (picture on left and text on the right). And then in the bottom section the text on the left and the picture to the right of the text.
Snippet
.alignnone {
width: 20%;
display: inline-block;
height: 20px;
padding: 13px;
box-sizing: border-box;
}
.first {}
.button {
text-decoration: none;
color: #000;
border-radius: 5px;
border: 1px solid;
padding: 10px;
background-color: #43dbdb;
margin: 1%;
float: left;
}
.drop {
width: 30% !important;
border: none;
padding: 0%;
float: right;
}
.top {
display: inline-block;
vertical-align: top;
padding: 2%;
}
.bottom {
display: inline-block;
vertical-align: bottom;
padding: 2%;
}
#content {
background-color: #D7DBDD;
background-size: 90%;
padding: 6%;
margin: -2%;
}
h2 {
text-align: center;
}
<div class="top">
<img src="https://privatechefanna.co.za/wp-content/uploads/2018/01/IMG_3695.jpg" height="99" width="99" alt="Anna" class="alignnone " />
<h3>ABOUT ME</h3>
<p class="first ">.....</p>
</div>
<div class="bottom">
<img src="https://privatechefanna.co.za/wp-content/uploads/2018/01/IMG_3713.jpg" height="99" width="99" alt="Anna" class="drop" />
<h3>WHAT I DO</h3>
<p class="second">.....</p>
</div>

Is this (created a codepen) something you are looking for?
<div class="top">
<div class="clearfix">
<img class="img1" src="https://privatechefanna.co.za/wp-content/uploads/2018/01/IMG_3713.jpg" width="99" height="99">
<h3>ABOUT ME</h3>
<p class="first ">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum...</p>
</div>
</div>
<div class="bottom">
<div class="clearfix">
<img class="img2" src="https://privatechefanna.co.za/wp-content/uploads/2018/01/IMG_3713.jpg" width="99" height="99">
<h3>WHAT I DO</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum...</p></div>
</div>
CSS:
.drop {
width: 30% !important;
border: none;
padding: 0%;
}
.top {
vertical-align: top;
padding: 2%;
}
.bottom {
vertical-align: bottom;
padding: 2%;
}
.clearfix {
overflow: auto;
}
.img2 {
float: right;
margin-left: 15px;
}
.img1{
float: left;
margin-right: 15px;
}

Related

How do I change element values only inside media query?

I'm trying to make a dropdown menu using html and css. However, when I change something in media query it also affects the same elements that's outside of it. Specifically,I have a horizontal navigation bar and I have sentered the links
vertically using "align-items:center".It works, but it also align my items the same way inside the media query.(on the dropdown, they appear in the middle"vertically" while I want them to me on top(x,y = 0).
I basically want my links inside media to be placed at the top while the same link outside the media to stay aligned.
Thank you..
* {
box-sizing: border-box;
font-family: sans-serif;
}
#media screen and (max-width:650px) {
#links{
background-color:red;
position:fixed;
inset:0 0 0 50%;
z-index:20;
align-self: flex-end;
}
#links ul{
flex-direction:column;
background-color: white;
}
}
#img{
width:3em;
height:3em;
}
#header-img{
display:flex;
}
#header{
display:flex;
justify-content: space-around;
}
#nav-bar{
display:flex;
justify-content: flex-end;
}
a{
text-decoration:none;
}
#links{
display:flex;
align-items:center;
}
#links ul{
list-style-type: none;
margin:0;
display:flex;
gap:5rem;
}
html {
height: 100%;
}
body {
margin: 0;
}
.main {
margin: 0;
padding-top: 68px;
background-color: #eee;
width: 98%;
margin-left: auto;
margin-right: auto;
}
.plans {
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.column {
width: 90%;
max-width:280px;
background-color: white;
height: 30em;
border-style: solid;
border-width: 1px;
border-radius: 5px;
box-shadow: 0 0 10px grey;
}
.column_3,
.column_2,
.column_1 {
margin: 20px 20px;
}
.column h5 {
text-align: center;
background-color: lightgrey;
margin-top: 0;
padding: 10px 0;
}
.column h5 p {
margin-top: 5px;
margin-bottom: 0;
font-size: 18px;
}
.pricing {
height: 52%;
margin-top: -22px;
width: 80%;
margin-left: auto;
margin-right: auto;
}
.pricing_content {
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
padding-top: 40px;
}
#link_one {
font-weight: bold;
font-size: .8em;
width: 45%;
padding: 10px 10px;
margin-left: auto;
margin-right: auto;
background-color: black;
border-radius: 3px;
border-style: solid;
border-width: 1px;
border-color: transparent;
}
#link_one:hover {
background-color: white;
border-style: solid;
border-width: 1px;
border-color: black;
color: black;
font-weight: bold;
}
#link_two {
font-size:.8em;
color: black;
font-weight: bold;
margin-top: 25px;
background-color: #eee;
width: 45%;
padding: 10px 10px;
margin-left: auto;
margin-right: auto;
}
#link_two:hover {
background-color: lightgrey;
}
#below_button {
margin-top: 60px;
}
.checks {
width: 100%;
}
.checks ul {
list-style-type: none;
}
.checks ul li:before {
content: "✓";
padding-right: 8px;
color: rgb(0, 230, 0);
}
ul li {
text-indent: -1.25em;
}
.separator {
height: 1px;
width: 80%;
margin-left: auto;
margin-right: auto;
background-color: lightgrey;
}
.benefits {
width: 100%;
min-height: 300px;
display: flex;
flex-wrap: wrap;
justify-content: center;
text-align: center;
background-color: #f4f4f4;
}
.fa-solid {
padding: 5px 5px;
color: rgb(0, 250, 0);
}
.rectangle {
display: flex;
flex-direction: column;
justify-content: center;
margin: 0 auto;
height: 300px;
min-width: 200px;
max-width:300px;
}
.footer {
width: 75%;
height: 200px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
bottom: 0;
position: static;
}
.contact_info {
background-color: black;
width: 100%;
height: 120px;
margin: 0 auto;
display: flex;
justify-content: space-between;
}
.icons_left ul {
list-style: none;
display: flex;
margin: 0;
padding: 40px 30px;
}
.icons_left ul li {
padding: 0 40px;
color: white;
}
.contact_right {
font-size: 1.05em;
padding: 10px 30px;
color: white;
}
.footer .fa-2x:hover {
color: rgb(0, 250, 0);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<script
src="https://kit.fontawesome.com/1724737a9d.js"
crossorigin="anonymous"
></script>
<title>Document</title>
</head>
<body>
<div class="wrap">
<div id="header">
<div id="header-img">
<img
id="img"
src="https://pngimg.com/uploads/gorilla/gorilla_PNG18705.png"
alt=""
/>
<h2>Gorilla Drive</h2>
</div>
<div id="nav-bar">
<nav id="links">
<ul>
<li class="nav-link">Deals</li>
<li class="nav-link">Benefits</li>
<li class="nav-link">Contact</li>
</ul>
</nav>
</div>
</div>
<div class="main">
<div class="plans">
<div class="column column_1">
<h5>
Basic<br />
<p>100 GB</p>
</h5>
<div class="pricing">
<div class="pricing_content">
<a id="link_one" href="#">$2,99/month</a>
<i id="below_button">Pay annualy (save 100%)</i>
<a id="link_two" href="">$20,99/year</a>
</div>
</div>
<div class="separator"></div>
<div class="checks">
<ul class="check_links">
<li>Lorem ipsum.</li>
<li>Lorem ipsum dolor.</li>
<li>Lorem ipsum dolor lahim.</li>
</ul>
</div>
</div>
<div class="column column_2">
<h5>
Standard<br />
<p>1 TB</p>
</h5>
<div class="pricing">
<div class="pricing_content">
<a id="link_one" href="#">$2,99/month</a>
<i id="below_button">Pay annualy (save 100%)</i>
<a id="link_two" href="">$20,99/year</a>
</div>
</div>
<div class="separator"></div>
<div class="checks">
<ul class="check_links">
<li>Lorem ipsum.</li>
<li>Lorem ipsum dolor.</li>
<li>Lorem ipsum dolor lahim.</li>
<li>Lorem ipsum dolor lahim baban.</li>
</ul>
</div>
</div>
<div class="column column_3">
<h5>
Premium<br />
<p>2 TB</p>
</h5>
<div class="pricing">
<div class="pricing_content">
<a id="link_one" href="#">$2,99/month</a>
<i id="below_button">Pay annualy (save 100%)</i>
<a id="link_two" href="">$20,99/year</a>
</div>
</div>
<div class="separator"></div>
<div class="checks">
<ul class="check_links">
<li>Lorem ipsum.</li>
<li>Lorem ipsum dolor.</li>
<li>Lorem ipsum dolor lahim.</li>
<li>Lorem ipsum dolor lahim baban.</li>
<li>Lorem ipsum dolor lahim baban sahim.</li>
</ul>
</div>
</div>
</div>
<div class="benefits">
<div class="rectangle rectangle_1">
<i class="fa-solid fa-fire fa-4x"></i>
<h4><b>High quality!</b></h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis
ullamcorper posuere nisi eu finibus.
</p>
</div>
<div class="rectangle rectangle_2">
<i class="fa-solid fa-jet-fighter-up fa-4x"></i>
<h4><b>Jet Fast support!</b></h4>
<p>
Proin feugiat sem tellus, commodo lacinia dui viverra ac. Sed
sollicitudin non metus sed sagittis. Nunc at tincidunt magna.
</p>
</div>
<div class="rectangle rectangle_3">
<i class="fa-solid fa-user-group fa-4x"></i>
<h4><b>Share with your family!</b></h4>
<p>
Aliquam vel mi blandit, venenatis risus vel, pellentesque nisl.
Suspendisse et sem leo.
</p>
</div>
</div>
</div>
</div>
<div class="footer"></div>
</body>
</html>
enter image description here
Add the flowing to the #links ul directly
#links ul {
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
}
and remove
ul li {
text-indent: -1.25em;
}

How can I stack Columns when window is resized [duplicate]

This question already has answers here:
Flexbox responsive row column layout
(3 answers)
Converting desktop layout to single-column mobile layout
(1 answer)
Closed 1 year ago.
I am working on a website.
I have a container, that has two columns. On the left, I have a product image, that when you hover on it, it shows that product in use.
To the right, I have a title, description, tech drawings.
I want it so that when the screen is resized to a mobile format, or even if the browser is shrunk, the columns will stack on top of one another.
Right now the image just gets smaller and smaller until you cannot see it.
I tried several attempts at using FlexBox. Did not have any luck. Here was the guide/rules I was following: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
Here is a quick JSfiddle I made up to see what I am talking about. This does not have any "attempt" code in it. Just the base code for the containing div, left and right columns, with some example images and text. https://jsfiddle.net/fmcdLxa4/1/
.container {
max-width: 1200px;
margin: 0 auto;
display: flex;
padding: 15px;
}
/* Columns */
.left-column {
float: left;
width: 50%;
padding: 10px;
position: relative;
border-bottom: 1px solid #E1E8EE;
}
.right-column {
float: left;
width: 50%;
padding: 10px;
}
/* Left Column */
.left-column img {
display: block;
margin-left: auto;
margin-right: auto;
vertical-align: auto;
}
/* Right Column */
/* Product Description */
.product-description {
border-bottom: 1px solid #E1E8EE;
}
.product-description span {
font-size: 12px;
color: #358ED7;
letter-spacing: 1px;
text-transform: uppercase;
text-decoration: none;
}
.product-description h1 {
font-weight: 300;
font-size: 52px;
color: #43484D;
letter-spacing: -2px;
}
.product-description p {
font-size: 16px;
font-weight: 300;
color: #86939E;
line-height: 24px;
}
.product-description a {
color: #358ED7;
}
.flip-box {
background-color: transparent;
width: 100%;
height: 100%;
perspective: 1000px;
}
.flip-box-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-box:hover .flip-box-inner {
transform: rotateY(180deg);
}
.flip-box-front,
.flip-box-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-box-front {
background-color: transparent;
}
.flip-box-back {
background-color: transparent;
transform: rotateY(180deg);
}
<div class="container">
<!-- Left Column -->
<div class="left-column">
<p> </p>
<div height="15"></div>
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<img src="https://dogtowndogtraining.com/wp-content/uploads/2012/06/300x300-061-e1340955308953.jpg" style="max-width: 100%">
</div>
<div class="flip-box-back">
<img src="http://www.deepdiveintel.com/wp-content/uploads/2013/09/Owl-Eye-art-300x300.jpg" style="max-width: 100%">
</div>
</div>
</div>
</div>
<!-- Right Column -->
<div class="right-column">
<!-- Product Description -->
<div class="product-description">
<span>Lorem ipsum dolor sit amet</span>
<h1>Lorem ipsum dolo</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi arcu sem, bibendum id tellus ac, aliquam faucibus massa. Nulla facilisi. Fusce vel condimentum velit. Praesent nec ultricies erat. Sed ante lectus, ultrices ut laoreet id, tincidunt
a augue.</p>
<p>Technical drawings: 7/0 | 8/0
<p />
</div>
</div>
</div>
Any help would be awesome!
flex can wrap if you set it so. Also, one of your card's image needs to remain in the flow, so it can size its container. then flex:1 1 XX% will do the job.
https://codepen.io/gc-nomade/pen/MWpxYZw
.container {
max-width: 1200px;
margin: 0 auto;
display: flex;
flex-wrap:wrap;
padding: 15px;
}
/* Columns */
.left-column {
flex:1 1 40%;
padding: 10px;
position: relative;
border-bottom: 1px solid #E1E8EE;
min-width:320px;
}
.right-column {
flex:1 1 40%;
padding: 10px;
}
/* Left Column */
.left-column img {
display: block;
margin-left: auto;
margin-right: auto;
vertical-align: auto;
}
/* Right Column */
/* Product Description */
.product-description {
border-bottom: 1px solid #E1E8EE;
}
.product-description span {
font-size: 12px;
color: #358ED7;
letter-spacing: 1px;
text-transform: uppercase;
text-decoration: none;
}
.product-description h1 {
font-weight: 300;
font-size: 52px;
color: #43484D;
letter-spacing: -2px;
}
.product-description p {
font-size: 16px;
font-weight: 300;
color: #86939E;
line-height: 24px;
}
.product-description a {
color: #358ED7;
}
.flip-box {
background-color: transparent;
width: 100%;
height: 100%;
perspective: 1000px;
}
.flip-box-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.8s;
transform-style: preserve-3d;
}
.flip-box:hover .flip-box-inner {
transform: rotateY(180deg);
}
.flip-box-back{
position: absolute;
top:0;
}
.flip-box-front,
.flip-box-back {
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-box-front {
background-color: transparent;
}
.flip-box-back {
background-color: transparent;
transform: rotateY(180deg);
}
<div class="container">
<!-- Left Column -->
<div class="left-column">
<p> </p>
<div height="15"></div>
<div class="flip-box">
<div class="flip-box-inner">
<div class="flip-box-front">
<img src="https://picsum.photos/id/1003/300/300" style="max-width: 100%">
</div>
<div class="flip-box-back">
<img src="https://picsum.photos/id/10/300/300" style="max-width: 100%">
</div>
</div>
</div>
</div>
<!-- Right Column -->
<div class="right-column">
<!-- Product Description -->
<div class="product-description">
<span>Lorem ipsum dolor sit amet</span>
<h1>Lorem ipsum dolo</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi arcu sem, bibendum id tellus ac, aliquam faucibus massa. Nulla facilisi. Fusce vel condimentum velit. Praesent nec ultricies erat. Sed ante lectus, ultrices ut laoreet id, tincidunt
a augue.</p>
<p>Technical drawings: 7/0 | 8/0
<p />
</div>
</div>
</div>

Absolute div height being cut off inside relative div

I'm having trouble getting one of my absolutely positioned divs to display correctly. It's getting cut off unless I set a height for the parent (relative) div which I can't do as I will never know the height required.
I originally wasn't using any absolute positioning but the contents of the comm div were wrapping underneath the avatar div so I thought absolute positioning would fix it and it has, apart from the text being cut off at the bottom.
This is the structure and you can see what's happening in this fiddle.
body {
background: #212121;
font-family: arial;
}
.main {
width: 80%;
margin: 20px auto;
}
.wrap {
width: 100%;
background: white;
padding: 10px;
overflow: hidden;
position: relative;
}
a.avatar {
width: 45px;
height: 45px;
border-radius: 50%;
overflow: hidden;
display: inline-block;
float: left;
margin-right: 10px;
position: relative;
}
a.avatar img {
width: 100%;
}
.top {
display: block;
overflow: hidden;
position: absolute;
left: 70px;
}
a.name {
font-weight: bold;
margin-right: 10px;
float: left;
}
.posted {
color: #BBB;
font-size: 12px;
padding-top: 3px;
float: left;
}
p.comm {
display: block;
position: absolute;
left: 70px;
top: 20px;
height: 100%;
}
<div class="main">
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png" />
<div class="top">
John Doe
<div class="posted">8 mins ago</div>
</div>
<p class="comm">Lorem ipsum dolor sit amet.
</p>
</div>
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png" />
<div class="top">
Jane Doe
<div class="posted">11 mins ago</div>
</div>
<p class="comm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</div>
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png" />
<div class="top">
Jimmy Doe
<div class="posted">18 mins ago</div>
</div>
<p class="comm">Ut enim ad minim veniam.
</p>
</div>
</div>
Try using this modified css code.
body {
background: #212121;
font-family: arial;
}
.main {
width: 80%;
margin: 20px auto;
}
.wrap {
width: 100%;
background: white;
padding: 10px;
position: relative;
}
a.avatar {
width: 45px;
height: 45px;
border-radius: 50%;
overflow: hidden;
display: inline-block;
float: left;
margin-right: 10px;
position: relative;
}
a.avatar img {
width: 100%;
}
.top {
display: flex;
margin-left: 70px;
}
a.name {
font-weight: bold;
margin-right: 10px;
}
.posted {
color: #BBB;
font-size: 12px;
padding-top: 3px;
}
p.comm {
display: block;
margin-left: 70px;
height: 100%;
}
You need to wrap .top and .comm in a div and with the use of flex you can achieve it
body {
background: #212121;
font-family: arial;
}
.main {
width: 80%;
margin:20px auto;
}
.wrap {
width: 100%;
background: white;
padding: 10px;
overflow: hidden;
position: relative;
display: flex;
}
a.avatar {
margin-right: 10px;
}
a.avatar img {
width: 45px;
height: 45px;
border-radius: 50%;
}
.top {
width: 100%;
overflow: hidden;
}
a.name {
font-weight: bold;
margin-right: 10px;
float: left;
}
.posted {
color: #BBB;
font-size: 12px;
padding-top: 3px;
float: left;
}
p.comm {
margin-top: 5px;
}
.right {
max-width: 88%;
}
<div class="main">
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png">
<div class="right">
<div class="top">
Jane Doe
<div class="posted">11 mins ago</div>
</div>
<p class="comm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do </p>
</div>
</div>
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png">
<div class="right">
<div class="top">
Jane Doe
<div class="posted">11 mins ago</div>
</div>
<p class="comm">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
<div class="wrap">
<img src="http://www.tangoflooring.ca/wp-content/uploads/2015/07/user-avatar-placeholder.png">
<div class="right">
<div class="top">
Jane Doe
<div class="posted">11 mins ago</div>
</div>
<p class="comm">Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
Working fiddle here
Just modify on your p.comm selector like below:
p.comm {
display: block;
position: relative;
top: 10px;
padding-left: 60px;
}

Why is my body not adjusting to the content in the webpage

While trying to content for a page while using an overlay grid, the content that im trying to place in exceeds the body boundaries? I'm trying to fix it, but i have no idea how? ive tried making a body reference in css as well as adjust the height, but no progress. Here is my code.
header {
height: 900px;
background-image: url('../img/large-banner-image.png');
background-repeat: no-repeat;
background-position: center top;
}
span {
font: 60px Pacifico, sans-serif;
font-weight: 400;
}
.Header-Type {
vertical-align: -16px
}
img {
display: inline-block;
margin: 17px;
}
h1 {
text-align: center;
position: relative;
top: 62px;
right: 13px;
}
h2 {
font: 22px Raleway, sans-serif;
font-weight: 700;
}
p {
font: 36px Raleway, sans-serif;
font-weight: 300;
text-align: center;
position: relative;
top: 90px;
}
.grey {
text-align: center;
position: relative;
height: 427px;
width: 1600px;
background-color: #e3e3e3;
bottom: -250px;
z-index: -1
}
.Phone {
float: right;
position: relative;
display: inline-block;
top: -567px;
right: 33.5%;
border-style: solid;
}
.Down-Arrow {
text-align: center;
position: relative;
top: -574px;
}
.white-button1 {
float: right;
display: inline-block;
position: absolute;
right: 53%;
bottom: -260px;
border-style: solid;
z-index: 1;
}
.white-button2 {
float: right;
display: inline-block;
position: absolute;
right: 53%;
bottom: -60px;
border-style: solid;
z-index: 1;
}
.white-button3 {
float: right;
display: inline-block;
position: absolute;
right: 44%;
bottom: 19px;
border-style: solid;
}
.black-button {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -170px;
border-style: solid;
}
.cursor {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -172px;
border-style: solid;
}
.angle {
float: right;
display: inline-block;
position: absolute;
right: 35.8%;
bottom: -267px;
border-style: solid;
}
.cursor {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -174px;
border-style: solid;
z-index: 1;
}
.content-alt {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
top: 750px;
left: 170px;
width: 20%;
}
.content-alt2 {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
top: 918px;
left: 170px;
width: 20%;
}
.content {
float: right;
margin-right: 100px;
margin-right: 5%;
position: absolute;
top: 750px;
right: 165px;
width: 20%;
}
.content2 {
float: right;
margin-right: 100px;
margin-right: 5%;
position: absolute;
top: 918px;
right: 165px;
width: 20%;
}
.alternate {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
left: 110px;
width: 36%;
}
.other {
display: none;
text-align: center;
}
.near-bottom {
display: none;
text-align: center;
}
footer {
word-spacing: 30px;
}
.text {
font: 16px HelveticaNeue, sans-serif;
line-height: 1.6;
font-weight: 400;
}
.footer {
display: none;
font: 16px HelveticaNeue, sans-serif;
font-weight: 400;
}
.Image {
display: none;
text-align: center;
}
<header>
<h1> <img style="vertical-align:middle" src="img/focus.png" /><span class="Header-Type">Focus</span></h1>
<p>A landing page for your app with focus</p>
</header>
<div class="Down-Arrow">
<img src="img/down-arrow.png" />
</div>
<div id="white">
<div class="Phone">
<img src="img/iphone.png" />
</div>
<div class="white-button1">
<img src="img/white-dot.png" />
</div>
<div class="white-button2">
<img src="img/white-dot.png" />
</div>
<div class="white-button3">
<img src="img/white-dot.png" />
</div>
</div>
<div class="black-button">
<img src="img/Black-dot.png" />
</div>
<div class="cursor">
<img src="img/cursor.png" />
</div>
<div class="angle">
<img src="img/angled-line.png" />
</div>
<div class="grey"></div>
<div id="text-content">
<div class="content-alt">
<h2>Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content">
<h2>Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content-alt2">
<h2>Another Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content2">
<h2>Another Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
</div>
<div class="alternate">
<h2>Get The App Today!</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse fringilla fringilla nisl congue congue. Maecenas nec condimentum libero, at elementum mauris. Phasellus eget nisi dapibus, ultricies nisl at, hendrerit risusuis ornare luctus id sollicitudin
ante lobortis at.</div>
</div>
<div class="other">
<h3>“Focus is an app that is extremely useful. I would reccomend it to anyone.”</h3>
<div>Kyle Turner, Blogger</div>
</div>
<div class="Image">
<img src="img/people.png" />
</div>
<div class="near-bottom">
<h4>Say Hi & Get in Touch</h4>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit suspendisse.</div>
</div>
<footer>
<p class="footer">Contact Download Press Email Support</p>
</footer>
Change the .grey width to 100%.
header {
height: 900px;
background-image: url('../img/large-banner-image.png');
background-repeat: no-repeat;
background-position: center top;
}
span {
font: 60px Pacifico, sans-serif;
font-weight: 400;
}
.Header-Type {
vertical-align: -16px
}
img {
display: inline-block;
margin: 17px;
}
h1 {
text-align: center;
position: relative;
top: 62px;
right: 13px;
}
h2 {
font: 22px Raleway, sans-serif;
font-weight: 700;
}
p {
font: 36px Raleway, sans-serif;
font-weight: 300;
text-align: center;
position: relative;
top: 90px;
}
.grey {
text-align: center;
position: relative;
height: 427px;
width: 100%;
background-color: #e3e3e3;
bottom: -250px;
z-index: -1
}
.Phone {
float: right;
position: relative;
display: inline-block;
top: -567px;
right: 33.5%;
border-style: solid;
}
.Down-Arrow {
text-align: center;
position: relative;
top: -574px;
}
.white-button1 {
float: right;
display: inline-block;
position: absolute;
right: 53%;
bottom: -260px;
border-style: solid;
z-index: 1;
}
.white-button2 {
float: right;
display: inline-block;
position: absolute;
right: 53%;
bottom: -60px;
border-style: solid;
z-index: 1;
}
.white-button3 {
float: right;
display: inline-block;
position: absolute;
right: 44%;
bottom: 19px;
border-style: solid;
}
.black-button {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -170px;
border-style: solid;
}
.cursor {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -172px;
border-style: solid;
}
.angle {
float: right;
display: inline-block;
position: absolute;
right: 35.8%;
bottom: -267px;
border-style: solid;
}
.cursor {
float: right;
display: inline-block;
position: absolute;
right: 43.4%;
bottom: -174px;
border-style: solid;
z-index: 1;
}
.content-alt {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
top: 750px;
left: 170px;
width: 20%;
}
.content-alt2 {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
top: 918px;
left: 170px;
width: 20%;
}
.content {
float: right;
margin-right: 100px;
margin-right: 5%;
position: absolute;
top: 750px;
right: 165px;
width: 20%;
}
.content2 {
float: right;
margin-right: 100px;
margin-right: 5%;
position: absolute;
top: 918px;
right: 165px;
width: 20%;
}
.alternate {
float: left;
margin-left: 100px;
margin-left: 5%;
position: absolute;
left: 110px;
width: 36%;
}
.other {
display: none;
text-align: center;
}
.near-bottom {
display: none;
text-align: center;
}
footer {
word-spacing: 30px;
}
.text {
font: 16px HelveticaNeue, sans-serif;
line-height: 1.6;
font-weight: 400;
}
.footer {
display: none;
font: 16px HelveticaNeue, sans-serif;
font-weight: 400;
}
.Image {
display: none;
text-align: center;
}
<header>
<h1> <img style="vertical-align:middle" src="img/focus.png" /><span class="Header-Type">Focus</span></h1>
<p>A landing page for your app with focus</p>
</header>
<div class="Down-Arrow">
<img src="img/down-arrow.png" />
</div>
<div id="white">
<div class="Phone">
<img src="img/iphone.png" />
</div>
<div class="white-button1">
<img src="img/white-dot.png" />
</div>
<div class="white-button2">
<img src="img/white-dot.png" />
</div>
<div class="white-button3">
<img src="img/white-dot.png" />
</div>
</div>
<div class="black-button">
<img src="img/Black-dot.png" />
</div>
<div class="cursor">
<img src="img/cursor.png" />
</div>
<div class="angle">
<img src="img/angled-line.png" />
</div>
<div class="grey"></div>
<div id="text-content">
<div class="content-alt">
<h2>Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content">
<h2>Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content-alt2">
<h2>Another Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
<div class="content2">
<h2>Another Great Feature</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum velit vitae nulla molestie eu. </div>
</div>
</div>
<div class="alternate">
<h2>Get The App Today!</h2>
<div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse fringilla fringilla nisl congue congue. Maecenas nec condimentum libero, at elementum mauris. Phasellus eget nisi dapibus, ultricies nisl at, hendrerit risusuis ornare luctus id sollicitudin
ante lobortis at.</div>
</div>
<div class="other">
<h3>“Focus is an app that is extremely useful. I would reccomend it to anyone.”</h3>
<div>Kyle Turner, Blogger</div>
</div>
<div class="Image">
<img src="img/people.png" />
</div>
<div class="near-bottom">
<h4>Say Hi & Get in Touch</h4>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit suspendisse.</div>
</div>
<footer>
<p class="footer">Contact Download Press Email Support</p>
</footer>
JSFiddle

Floating divs inside inline-block parent goes down on resize

I have 2 floating divs, inner-left and inner-right inside parent container inner-container.
inner-container is set to display: inline-block; to have it's width to be equal of width of it's children.
The problem is, when I resize the window, inner-right div goes down and only then starts to resize itself.
How do I inner-right make it stay on the same line with inner-left, and, in the event of window resize, to resize instead of going down?
HTML:
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<div class="inner-container">
<div class="inner-left"><img src="http://placehold.it/100x100" alt=""></div>
<div class="inner-right"><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In justo orci, rutrum nec feugiat sed, ultrices non dolor. Aliquam laoreet.</strong><br>
Vivamus purus metus.
</div>
</div>
</div>
CSS:
.container {
background-color: #f0fff0;
padding: 10px;
border: 1px solid #bce2c1;
border-radius: 5px;
}
.inner-container {
padding: 10px;
background-color: #ffffff;
border: 1px solid #bce2c1;
border-radius: 5px;
margin-top: 10px;
display: inline-block;
}
.inner-left {
float:left;
width: 60px;
}
.inner-left img {
height: 60px;
width: 60px;
}
.inner-right {
float:right;
text-align: left;
padding-left: 10px;
}
JSFIDDLE:
https://jsfiddle.net/acidonyx/naw6ojwe/4/
well just remove float: right from .inner-right and your problem will be solved.
.inner-right {
text-align: left;
padding-left: 10px;
}
to solve your other problem you can do
.inner-right {
overflow: hidden;
text-align: left;
padding-left: 10px;
}
For this you should use flexbox, here with inline-flex to fit your requirement
.container {
display: inline-block;
background-color: #f0fff0;
padding: 10px;
border: 1px solid #bce2c1;
border-radius: 5px;
}
.inner-container {
display: inline-flex;
padding: 10px;
background-color: #ffffff;
border: 1px solid #bce2c1;
border-radius: 5px;
margin-top: 10px;
}
.inner-left img {
height: 60px;
width: 60px;
}
.inner-right {
padding-left: 10px;
}
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<div class="wrap-container">
<div class="inner-container">
<div class="inner-left">
<img src="http://placehold.it/100x100" alt="">
</div>
<div class="inner-right"><strong>Lorem ipsum dolor sit</strong>
<br>Vivamus purus metus.
</div>
</div>
</div>
</div>
You could try floating .inner-right to the left instead, and giving it a width set in a percentage value, like this:
.inner-right {
float:left;
width: 85%;
}
JSFIDDLE
You can use media queries to update the percentage as you need.