I have an element with an image and some text next to it, The content is centered inside the parent.
When I try to add more elements after the image and the text, As you see the green text with red border overflows the parent .about and goes to the next parent .contact-us
Here is a fiddle to view and edit the code:
https://jsfiddle.net/04rmefx7/
Here is the code:
body,
html {
height: 100%;
}
.inline-block {
display: inline-block;
}
/* Start about */
.about {
background-color: #dad04a;
position: relative;
height: 100%
}
.about img {
height: 100px;
}
p{
border: 4px solid red;
color: green;
font-weight: bold;
}
/* End about */
/* Start contact-us */
.contact-us {
background-color: #eeb03c;
}
/* End contact-us -->
<link href="https://getbootstrap.com/docs/3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Start about -->
<div class="about text-center">
<div class="inline-block">
<img class="pull-left" src="https://placehold.it/600">
<div class="pull-left text-left">
<h4 class="inline-block">Heading</h4>
<span>Lorem ipsum dolor sit amet</span>
<br>
<span>Lorem ipsum dolor sit amet</span>
<br>
<span>Lorem ipsum dolor sit amet</span>
<br>
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</span>
<br>
<span>Lorem ipsum dolor sit amet</span>
</div>
<div class="clearfix"></div>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et velit officia alias harum nam illum pariatur deleniti reprehenderit, aliquam, commodi iure modi, facilis error dolorum doloribus. Porro, hic explicabo dolores. Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Dolore dolor explicabo quas, est, iure non repellendus eaque, nemo eum repudiandae voluptatem rem quos iste a. Non nisi aliquid consequuntur. Libero!</p>
</div>
<!-- End about -->
<!-- Start contact-us -->
<div class="contact-us text-center">
<h2>Contact us</h2>
</div>
<!-- End contact-us -->
Does it work for you to remove height: 100% from .about?
Related
I don't understand why 2nd div is not up of 1st div. I want they 2 div perfectly set as like my image direction. already i try display block but not working. i don't know why main problem. already i have many research, but all fail. so please help me to solution my problem. advanced thanks and love from my top heart.
`
.testimonial .content{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.testimonial .content .testimonialBx{
max-width: calc(50% - 40px);
padding: 60px 40px;
margin: 20px;
background: #2196f3;
}
<section class="testimonial">
<div class="heading">
<h2>Testimonial</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure!</p>
</div>
<div class="content">
<div class="testimonialBx">
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Suscipit necessitatibus culpa magnam ipsum illum provident nostrum id temporibus? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat similique nostrum harum! Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime quos quo qui in.</p>
<h3>Someone Famous <br><span>Creative Designer</span></h3>
</div>
</div>
<div class="content">
<div class="testimonialBx">
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Suscipit necessitatibus culpa magnam ipsum illum provident nostrum id temporibus? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat similique nostrum harum! Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime quos quo qui in.</p>
<h3>Someone Famous <br><span>Creative Designer</span></h3>
</div>
</div>
</section>
`
Wrap those 2 divs in 1 div and make it as flex.
Updated Code
.testimonial .content {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.testimonial .content .testimonialBx {
max-width: calc(50% - 40px);
padding: 60px 40px;
margin: 20px;
background: #2196f3;
}
.container {
display: flex;
}
<!DOCTYPE html>
<html>
<head> </head>
<body>
<section class="testimonial">
<div class="heading">
<h2>Testimonial</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iure!</p>
</div>
<div class="container">
<div class="content">
<div class="testimonialBx">
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Suscipit necessitatibus culpa magnam ipsum illum provident nostrum id temporibus? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat similique nostrum harum! Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime quos quo qui in.</p>
<h3>Someone Famous <br><span>Creative Designer</span></h3>
</div>
</div>
<div class="content">
<div class="testimonialBx">
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Suscipit necessitatibus culpa magnam ipsum illum provident nostrum id temporibus? Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat similique nostrum harum! Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime quos quo qui in.</p>
<h3>Someone Famous <br><span>Creative Designer</span></h3>
</div>
</div>
</div>
</section>
</body>
</html>
Answer from #nagendraNag is ideal. I would just remove the max-width
max-width: calc(50% - 40px);
This question already has answers here:
What is a clearfix?
(10 answers)
How do you get the footer to stay at the bottom of a Web page?
(32 answers)
Fill remaining vertical space with CSS using display:flex
(6 answers)
Closed 2 years ago.
I have seen many answers but none seem to work for me...
My footer has come right next to the paragraphs. How can I get them to down of the page... Also how to make the whole page be seen at the same time without needing to scroll down?
Below is my code:
body {
margin: 0;
padding: 0;
background: #85dcb8;
}
header {
background: coral;
padding: 1px;
margin: 0px;
text-align: center;
border-bottom: black 4px solid;
float: center;
}
header h1 {
margin: 0px;
}
header p {
border-bottom: solid 5px black;
display: inline-block;
padding-bottom: 10px;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
text-align: center;
width: 70%;
margin-left: 20%;
}
.side-bar {
grid-gap: 2px;
padding-left: 10px;
float: left;
}
.links {
display: block;
width: 100%;
padding: 10px 20px;
border-bottom: 1px solid black;
}
a {
text-decoration: none;
color: red;
}
a:hover {
color: blue;
text-decoration: underline;
}
footer {
background-color: #000000;
color: #fff;
line-height: normal;
word-spacing: 2px;
text-align: center;
padding: 50px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Web Page</title>
</head>
<body>
<header>
<h1>Welcome to my web page</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti, ab!
</p>
</header>
<aside>
<div class="side-bar">
<div class="links">Page 1</div>
<div class="links">Page 2</div>
<div class="links">Page 3</div>
<div class="links">Page 4 </div>
<div class="links">Page 5</div>
<div class="links">Page 6</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
</div>
</aside>
<section>
<div class="container">
<div>
<h2>Heading 1</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 2</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 3</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
</div>
</section>
<footer>
This webpage officialy belongs to Anirudh. Copyrights since 2020 ©
</footer>
</body>
</html>
Adding a margin and giving it a particular value makes it hard in math...So I would prefer some easier method with simple CSS.
Image of how it looks for me.
Also any mistakes in my code that can be improved to make it more efficient?
Thanks.
EDIT: Adding an empty div helped me...Empty div with the class of clr and using clear:both; for the clr class in CSS works..
body {
margin: 0;
padding: 0;
background: #85dcb8;
}
header {
background: coral;
padding: 1px;
margin: 0px;
text-align: center;
border-bottom: black 4px solid;
float: center;
}
header h1 {
margin: 0px;
}
header p {
border-bottom: solid 5px black;
display: inline-block;
padding-bottom: 10px;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
text-align: center;
width: 70%;
margin-left: 20%;
}
.side-bar {
grid-gap: 2px;
padding-left: 10px;
float: left;
}
.links {
display: block;
width: 100%;
padding: 10px 20px;
border-bottom: 1px solid black;
}
a {
text-decoration: none;
color: red;
}
a:hover {
color: blue;
text-decoration: underline;
}
footer {
background-color: #000000;
color: #fff;
line-height: normal;
word-spacing: 2px;
text-align: center;
padding: 50px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Web Page</title>
</head>
<body>
<header>
<h1>Welcome to my web page</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti, ab!
</p>
</header>
<aside>
<div class="side-bar">
<div class="links">Page 1</div>
<div class="links">Page 2</div>
<div class="links">Page 3</div>
<div class="links">Page 4 </div>
<div class="links">Page 5</div>
<div class="links">Page 6</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
</div>
</aside>
<section>
<div class="container">
<div>
<h2>Heading 1</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 2</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 3</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
</div>
</section>
<footer>
This webpage officialy belongs to Anirudh. Copyrights since 2020 ©
</footer>
</body>
</html>
It's working...
body {
margin: 0;
padding: 0;
background: #85dcb8;
}
header {
background: coral;
padding: 1px;
margin: 0px;
text-align: center;
border-bottom: black 4px solid;
float: center;
}
header h1 {
margin: 0px;
}
header p {
border-bottom: solid 5px black;
display: inline-block;
padding-bottom: 10px;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
text-align: center;
width: 70%;
margin-left: 20%;
}
.side-bar {
grid-gap: 2px;
padding-left: 10px;
float: left;
}
.links {
display: block;
width: 100%;
padding: 10px 20px;
border-bottom: 1px solid black;
}
a {
text-decoration: none;
color: red;
}
a:hover {
color: blue;
text-decoration: underline;
}
footer {
background-color: #000000;
color: #fff;
line-height: normal;
word-spacing: 2px;
text-align: center;
padding: 50px;
clear: both;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Web Page</title>
</head>
<body>
<header>
<h1>Welcome to my web page</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti, ab!
</p>
</header>
<aside>
<div class="side-bar">
<div class="links">Page 1</div>
<div class="links">Page 2</div>
<div class="links">Page 3</div>
<div class="links">Page 4 </div>
<div class="links">Page 5</div>
<div class="links">Page 6</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
</div>
</aside>
<section>
<div class="container">
<div>
<h2>Heading 1</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 2</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 3</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
</div>
</section>
<footer>
This webpage officialy belongs to Anirudh. Copyrights since 2020 ©
</footer>
</body>
</html>
You can check now... it's working
section, aside {
min-height: calc(100vh - 100px);
/* here, replace 100px with the size of your header and footer */
}
This makes it so the main content is, at a minimum, the size of the screen minus the header and the footer size, thus pushing the footer to the bottom of the page.
As for the rest of your code, it looks fine to me.
body {
margin: 0;
padding: 0;
background: #85dcb8;
}
header {
background: coral;
padding: 1px;
margin: 0px;
text-align: center;
border-bottom: black 4px solid;
float: center;
}
header h1 {
margin: 0px;
}
header p {
border-bottom: solid 5px black;
display: inline-block;
padding-bottom: 10px;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
text-align: center;
width: 70%;
margin-left: 20%;
}
.side-bar {
grid-gap: 2px;
padding-left: 10px;
float: left;
}
.links {
display: block;
width: 100%;
padding: 10px 20px;
border-bottom: 1px solid black;
}
a {
text-decoration: none;
color: red;
}
a:hover {
color: blue;
text-decoration: underline;
}
footer {
background-color: #000000;
color: #fff;
line-height: normal;
word-spacing: 2px;
text-align: center;
padding: 50px;
clear: both;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Web Page</title>
</head>
<body>
<header>
<h1>Welcome to my web page</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti, ab!
</p>
</header>
<aside>
<div class="side-bar">
<div class="links">Page 1</div>
<div class="links">Page 2</div>
<div class="links">Page 3</div>
<div class="links">Page 4 </div>
<div class="links">Page 5</div>
<div class="links">Page 6</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
<div class="links">Page 7</div>
<div class="links">Page 8</div>
<div class="links">Page 9</div>
<div class="links">Page 10</div>
</div>
</aside>
<section>
<div class="container">
<div>
<h2>Heading 1</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 2</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 3</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 4</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 5</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
<div>
<h2>Heading 6</h2>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facilis possimus consequuntur optio libero. Beatae praesentium officia quos odio saepe.
</p>
</div>
</div>
</section>
<footer>
This webpage officialy belongs to Anirudh. Copyrights since 2020 ©
</footer>
</body>
</html>
I'm setting media queries for tablet-size screens and my nav bar, header logo and top section don't seem to want to stack properly. If I fix the position of the nav I'm losing the section heading or if I put the nav position as static the nav bar is trying to hide behind it. So, when I reduce to 680px or below I get this at the top of my screen -
Or this -
It all stacks fine at 480px and below so not sure what I'm doing wrong. Here are my media queries -
#media screen and (max-width: 680px) {
nav {
float: none;
text-align: center;
padding-bottom: 10px;
padding-top: 10px;
}
nav a {
display: block;
border-bottom: 0;
}
#logo {
height: auto;
}
#logo img {
width: 200px;
height: 100px;
position: relative;
top: 0;
left: 21%;
}
section {
float: none;
height: auto;
}
}
#media screen and (max-width: 480px) {
body {
max-width: 500px;
}
header {
height: auto;
}
nav {
text-align: center;
padding-bottom: 10px;
padding-top: 10px;
position: static;
}
nav a {
display: block;
border-bottom: 0;
}
nav a:hover {
background-color: rgba(0,0,0,0.6);
color: #fff;
}
#logo {
height: auto;
}
#logo img {
width: 200px;
height: 100px;
position: relative;
top: 0;
left: 21%;
}
section {
float: none;
height: auto;
font-size: 20px;
}
<header>
<div id="logo"> <img src="images/havoc_logo.png"> </div>
<nav>
Home
What we do
Who we are
Who we work with
Say hello
Blog
</nav>
</header>
<section id="whatwedo">
<div class="container-fluid">
<h1><span style="color: rgb(133,52,146);">+</span>What we do</h1>
<div class="cols">
<div class="row no-gutters">
<div class="col-md-3">
<h2>ADVERTISING</h2>
<img src="images/advertising.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>GRAPHIC DESIGN</h2>
<img src="images/graphic_design.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>BRAND IDENTITY</h2>
<img src="images/brand_identity.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>BRAND GUIDELINES</h2>
<img src="images/beard.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-md-3">
<h2>PRINT MANAGEMENT</h2>
<img src="images/print.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>CREATIVE DIRECTION</h2>
<img src="images/creative_direction.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>EDITORIAL DESIGN</h2>
<img src="images/ed_design.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
<div class="col-md-3">
<h2>AND LOTS OF OTHER STUFF</h2>
<img src="images/other_stuff.jpg" class="image" style="width: 100%; height: 300px;">
<div class="overlay">
<div class="text"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</br> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Alias cum repellat velit quae suscipit.</div>
</div>
</div>
</div>
</div>
</div>
</section>
Any help appreciated.
I think your problem is the height!
Try with min-height.
It is really hard to find errors in your code when this amount of it is provided. You should post relevant html, use css-flexbox or bootstrap grid (or any other grid system). You can find Bootrstrap v.4 grid only (withot any other styling) here. Hope it helps!
I wonder if there is the way to create css-rules to display the articles in three columns as shown (http://i.stack.imgur.com/XRSGs.png). Preferred HTML markup is:
<div>1</div>
<div>2</div>
<div>3</div>
...
<div>6</div>
The only condition is to avoid additional manipulations with html-markup during the render - no nested blocks and so on. Any ideas?
Please see the code at JSFiddle: jsfiddle.net/3nv7rkcg
Its very difficult to make from css and it can't be dynamic. So please better to use js http://isotope.metafizzy.co/ .
Now we can make it from css too :)
Here is the code
#import "compass/css3";
*, *:before, *:after {box-sizing: border-box !important;}
article {
-moz-column-width: 13em;
-webkit-column-width: 13em;
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
}
section {
display: inline-block;
margin: 0.25rem;
padding: 1rem;
width: 100%;
background: #efefef;
}
p {
margin: 1rem 0;
}
/* styles for background color, etc; not necessary for this thing to work */
body {
padding: 1em;
font-family: "Garamond", serif;
}
h1 {
font-size: 3rem;
font-weight: 800;
}
body {
line-height: 1.25;
}
p {
text-align: left;
}
<article>
<section>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.</p>
</section>
<section>
<p>Lorem ipsum dolor sit.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.</p>
</section>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.</p>
</section>
</article>
I'm currently trying to center my block elements that i've laid out as a UL within a NAV so each block element is an LI with child elements within it.
This is my first time using F4 or Foundation for that matter.
I've been using .container for new 100% full width divs, within those i use rows (however rows also has 100% width per foundation.css) I want my LI's to be responsive so my logic was to add the .small-# and .large-# classes to the LI's themselves and then figure out how i want them to break and stack at smaller screen sizes.
When i reduce the size of the browser window my elements (LI's) stack on top of each other, which is fine, however the background container does not auto heighten to wrap around these elements.
Anyways here's the markup:
<div class="container l-capListBg">
<div class="row capListContainer">
<nav class="capList">
<ul>
<li class="small-4 large-2 colums">
<img src="img/icon-ds.png" alt="">
<h5>Digital<br>Strategy</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum, magni iure quod vel dolor excepturi.</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-di.png" alt="">
<h5>Digital<br>Interactive</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam, laboriosam, quibusdam sequi sint asperiores magni.</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-csm.png" alt="">
<h5>Collaboration & Social Media</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic, optio officia reiciendis laudantium atque deserunt!</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-is.png" alt="">
<h5>Infrastructure Services</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam libero aspernatur aliquid minus aperiam quos!</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-iaas.png" alt="">
<h5>Identity-As-A-Service</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil et repellendus cupiditate minus consectetur consequatur.</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-ca.png" alt="">
<h5>Communications Analytics</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores, eius harum aliquam assumenda officiis nihil.</p>
</li>
</ul>
</nav>
</div>
</div>
And here is the CSS:
.l-capListBg {
background: $lt-grey;
position: relative;
}
.capListContainer {
position: relative;
// max-width: 1000px;
// min-width: auto;
max-height: auto;
margin: 0 auto;
background: $lt-grey;
}
nav.capList {
position: absolute;
top: -50px;
left: 0;
list-style-type: none;
ul {
display: inline-block;
li {
display: inline-block;
vertical-align: top;
padding: 20px 0.5em 0;
width: 155px;
}
img {
width: auto;
height: auto;
}
h5 {
font-weight: 200;
color: $black;
height: 50px;
}
p {
font-size: 0.750em;
font-weight: $lighter;
vertical-align: top;
line-height: 1.250em;
}
}
}
Basically when i reduce the size of the browser window and the LI items begin to stack on top of each other (there are six and they end up stacking 3 rows of 2) the background container (which also has a color of grey) doesn't auto heighten when the other elements that are being pushed down.
I've been working on this for hours and really need some help.
Any advice would be greatly appreciated.
Thanks.
try with this:
foundation block-grid
<ul small-block-grid-3 medium-block-grid-6>
<li >
<img src="img/icon-ds.png" alt="">
<h5>Digital<br>Strategy</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum, magni iure quod vel dolor excepturi.</p>
</li>
<li >
<img src="img/icon-di.png" alt="">
<h5>Digital<br>Interactive</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam, laboriosam, quibusdam sequi sint asperiores magni.</p>
</li>
<li >
<img src="img/icon-csm.png" alt="">
<h5>Collaboration & Social Media</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic, optio officia reiciendis laudantium atque deserunt!</p>
</li>
<li >
<img src="img/icon-is.png" alt="">
<h5>Infrastructure Services</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam libero aspernatur aliquid minus aperiam quos!</p>
</li>
<li >
<img src="img/icon-iaas.png" alt="">
<h5>Identity-As-A-Service</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil et repellendus cupiditate minus consectetur consequatur.</p>
</li>
<li class="small-4 large-2 colums">
<img src="img/icon-ca.png" alt="">
<h5>Communications Analytics</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores, eius harum aliquam assumenda officiis nihil.</p>
</li>
</ul>