I want to have a css grid as follows.
A
1
2
3
4
5
6
7
8
A is like the header and numbers (1 to 8) are data that comes from an API. I want to have A as the same height as numbers so I cannot use grid-row: 1/-1. I don't want to add an empty cell in every 4th item because I'm using AlpineJS x-for and it only supports only one child element.
body {
max-width: 1280px;
margin: 2rem auto;
}
.tier-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 1rem;
}
.card {
display: flex;
flex-direction: column;
align-items: center;
background-color: #F1F1F1;
border-radius: 0.2rem;
padding: 2rem 1rem;
}
.card button {
margin-top: auto;
}
.btn {
cursor: pointer;
font-size: 1rem;
border: none;
padding: 0.5rem 2rem;
}
.btn:hover {
opacity: 0.8;
}
.btn-primary {
background: #6944CE;
color: white;
border-radius: 1rem;
}
.info {
border-radius: 0.2rem;
overflow: hidden;
display: flex;
flex-direction: column;
}
.info p {
margin: auto;
}
.info-footer {
margin-top: auto;
background: #6944CE;
color: white;
padding: 1rem;
text-align: center;
}
<div class="tier-grid">
<div class="card">
<h1>Tier 1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolore veritatis, excepturi, laudantium optio,
molestiae quo cumque illo harum laborum dignissimos nisi ut et modi dolor minus ex dolores voluptate. Unde.</p>
<button class="btn btn-primary">Learn More</button>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<p>I want this to be an empty cell.</p>
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<p>I want this to be an empty cell.</p>
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
</div>
What about something like this:
.info:nth-child(3n) {
border: 3px solid red;
grid-column: 3;
}
.info:nth-child(3n+1) {
border: 3px solid blue;
grid-column: 4;
}
.info:nth-child(3n+2) {
border: 3px solid green;
grid-column: 2;
}
This will allow you to place the info items on your desired column without needing to add any extra "dummy" content element for the "empty cells"
body {
max-width: 1280px;
margin: 2rem auto;
}
.tier-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 1rem;
}
.card {
display: flex;
flex-direction: column;
align-items: center;
background-color: #F1F1F1;
border-radius: 0.2rem;
padding: 2rem 1rem;
}
.card button {
margin-top: auto;
}
.btn {
cursor: pointer;
font-size: 1rem;
border: none;
padding: 0.5rem 2rem;
}
.btn:hover {
opacity: 0.8;
}
.btn-primary {
background: #6944CE;
color: white;
border-radius: 1rem;
}
.info {
border-radius: 0.2rem;
overflow: hidden;
display: flex;
flex-direction: column;
}
.info:nth-child(3n) {
border: 3px solid red;
grid-column: 3;
}
.info:nth-child(3n+1) {
border: 3px solid blue;
grid-column: 4;
}
.info:nth-child(3n+2) {
border: 3px solid green;
grid-column: 2;
}
.info p {
margin: auto;
}
.info-footer {
margin-top: auto;
background: #6944CE;
color: white;
padding: 1rem;
text-align: center;
}
<div class="tier-grid">
<div class="card">
<h1>Tier 1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolore veritatis, excepturi, laudantium optio, molestiae quo cumque illo harum laborum dignissimos nisi ut et modi dolor minus ex dolores voluptate. Unde.</p>
<button class="btn btn-primary">Learn More</button>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
<div class="info">
<img src="https://via.placeholder.com/150" alt="Placeholder Image" />
<span class="info-footer">Buy Now</span>
</div>
</div>
Does adding
.card {
...
grid-row: 1 / span 3;
}
get what you want? I'm trying to see if you can make this dynamic and just fill all the columns instead of specifying how many you have but I want to check first if this is in the right direction.
Related
I have created a calendar that displays each day in a column, and each day has multiple rows. I also added scroll snap to the grid. So the user can swipe horizontally to view each day. However due to the number of rows under the days, swiping (mobile) moves in both directions (vertically and horizontally). I'd like it to lock the swipe to go one direction at a time. So when the user swipes horizontally, the days move, once the day grid snaps in place, they can scroll vertically, or horizontally if they like. Here is my demo: https://codepen.io/starkana/pen/YzzBgPN
CSS & HTML
*,
:after,
:before {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html {
font-size: 62.5%;
}
body {
color: #384ad2;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-size: 1.6rem;
height: 100%;
font-family: arial;
}
a {
text-decoration: none;
color: inherit;
}
body {
background: #ccc;
}
.calendar {
max-height: 100vh;
max-width: 100vh;
display: grid;
grid-template-columns: repeat(9, 80vw);
grid-column-gap: 20px;
scroll-snap-type: x mandatory;
padding-left: 5vw;
transition: transform 0.2s ease-in-out;
overflow-x: scroll;
justify-content: left;
}
.day {
margin-bottom: 100px;
min-width: 0;
scroll-snap-align: center;
}
.day h2 {
font-size: 1.5rem;
font-weight: 900;
letter-spacing: 0.1rem;
text-align: left;
text-transform: uppercase;
margin: 1rem 0;
}
.cards {
display: grid;
grid-row-gap: 6px;
grid-column-gap: 24px;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
justify-content: center;
min-width: 0;
}
.card {
background: #fff;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(49, 54, 68, 0.05),
0 5px 20px rgba(49, 54, 68, 0.08);
max-height: 65px;
margin-bottom: 24px;
position: relative;
transition: box-shadow 0.6s ease, color 0.2s ease,
transform 0.2s ease-in-out;
}
.card:hover {
box-shadow: 0 4px 6px rgba(138, 155, 198, 0.05),
0 5px 25px rgba(82, 112, 194, 0.15);
}
.card:hover .highlighter {
opacity: 1;
}
.card a {
display: grid;
grid-template-columns: 50px auto;
}
.content {
padding: 10px 14px;
position: relative;
border: 1px solid red;
min-width: 0;
}
.title {
font-size: 1.4rem;
font-weight: 800;
overflow: hidden;
padding-bottom: 3px;
text-overflow: ellipsis;
white-space: nowrap;
}
.airing {
font-size: 1.3rem;
font-weight: 600;
opacity: 0.9;
}
.next,
.now {
background: blue;
border-radius: 4px;
top: -14px;
color: white;
font-size: 1.1rem;
font-weight: 800;
padding: 3px 8px;
position: absolute;
right: -12px;
}
.image {
border-radius: 4px 0 0 4px;
height: 100%;
max-height: 65px;
object-fit: cover;
object-position: center;
transition: opacity 0.3s;
width: 100%;
}
<div class="calendar">
<div class="day">
<h2>Monday</h2>
<div class="cards">
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
</div>
</div>
<div class="day">
<h2>Monday</h2>
<div class="cards">
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
</div>
</div>
<div class="day">
<h2>Monday</h2>
<div class="cards">
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
</div>
</div>
<div class="day">
<h2>Monday</h2>
<div class="cards">
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
</div>
</div>
<div class="day">
<h2>Monday</h2>
<div class="cards">
<div class="card">
<a href="#">
<img
src="/app/static/img/covers/large/12903-RSbXdLBGyI.jpg"
class="image"
/>
<div class="content">
<div class="title">Title</div>
<div class="airing">Subtitle</div>
</div>
</a>
</div>
</div>
</div>
</div>
This question already has answers here:
Is there a way to escape clip-path: from child elements? I.E images positioned relative to the clipped background, also get clipped
(1 answer)
Child Element Disappears after clip-path added
(1 answer)
clip-path without clipping content
(1 answer)
Closed 3 years ago.
const ham = document.querySelector('.nav-box');
const menu = document.querySelector('.menu');
const menuClose = document.querySelector('#menu-close');
ham.addEventListener('click', function() {
ham.classList.add('ham-open');
menu.style.marginLeft = '50px';
})
menuClose.addEventListener('click', function() {
ham.classList.remove('ham-open');
menu.style.marginLeft = '-700px';
})
window.sr = ScrollReveal();
sr.reveal('.info', {
duration: 2000,
origin: 'bottom'
})
html, body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.header {
background: url(https://picsum.photos/id/1016/3844/2563);
width: 100%;
height: 100vh;
background-size: cover;
background-attachment: fixed;
background-position: center;
display: flex;
}
.nav-wrap {
flex-basis: 40%;
}
.nav-wrap i {
color: white;
font-size: 2rem;
position: absolute;
right: -33px;
top: 0px;
transition: all .1s ease;
}
.nav-wrap i:hover {
cursor: pointer;
transform: scale(1.15);
}
.nav-box {
margin-left: 50px;
margin-top: 100px;
max-width: 70px;
cursor: pointer;
position: fixed;
z-index: 10;
}
.b1, .b2, .b3 {
width: 70px;
height: 8.5px;
border-radius: 5px;
background-color: #fff;
margin-bottom: 10px;
transition: all .15s ease;
}
.b1 {
background-color: #56ff47;
}
.b3 {
background-color: #ff4c4c;
}
.ham-open .b1 {
background-color: #56ff47;
transform: translateY(100px);
position: relative;
z-index: 1;
}
.ham-open .b2 {
transform: translateY(81.5px);
width: 110px;
position: relative;
left: 60px;
z-index: 0;
}
.ham-open .b3 {
background-color: #ff4c4c;
transform: translateY(63px);
width: 140px;
position: relative;
left: 160px;
z-index: 2;
}
.menu {
display: flex;
border-left: 8px solid #56ff47;
flex-direction: column;
background-color: #fff;
margin-left: -700px;
width: 292px;
padding-top: 10px;
padding-bottom: 10px;
position: fixed;
border-radius: 5px;
top: 225px;
transition: all .15s;
z-index: 10;
}
.menu a {
text-decoration: none;
color: limegreen;
font-family: 'Kumar One Outline';
font-size: 2.3rem;
text-align: center;
margin-top: 12px;
margin-bottom: 12px;
transition: all .5s ease;
}
a:hover {
color: #007001;
}
.info-wrap {
flex-basis: 60%;
}
.info {
font-family: 'Cedarville Cursive';
color: white;
font-weight: bold;
font-size: 4.5rem;
text-align: center;
margin-top: 60px;
}
.logo-wrap {
display: flex;
justify-content: center;
flex-direction: column;
}
.logo-wrap div {
font-family: 'Staatliches';
color: white;
font-size: 13rem;
font-weight: bold;
letter-spacing: 10px;
margin-bottom: -5rem;
position: relative;
margin-left: auto;
margin-right: auto;
}
/*------ABOUT------*/
.about-section {
background-color: #17a832;
width: 100%;
position: relative;
}
.about-section h1 {
text-align: center;
font-size: 4.5rem;
margin-top: 0;
margin-bottom: 30px;
padding-top: 15px;
color: white;
font-family: 'Cedarville Cursive';
font-weight: bold;
}
.about-line {
width: 350px;
height: 5px;
background-color: #edb12f;
border-radius: 4px;
position: absolute;
top: 120px;
left: 0;
right: 0;
bottom: 0;
margin: 0 auto;
}
.about-wrap {
display: flex;
padding-bottom: 150px;
}
.about-info, .image-slider-wrap {
flex-basis: 50%;
}
.about-info p {
color: white;
font-family: 'Josefin Sans';
font-size: 2rem;
margin-left: 100px;
margin-bottom: 0;
margin-top: 0;
}
.image-slider {
width: 650px;
height: 400px;
background-color: red;
border-radius: 13px;
margin-left: auto;
margin-right: auto;
position: relative;
}
.image-slider i {
color: white;
font-size: 5rem;
position: absolute;
top: 50%;
margin-top: -40px;
transition: all .1s ease;
cursor: pointer;
}
#left {
transform: rotate(-90deg);
left: -30px;
}
#right {
transform: rotate(90deg);
right: -30px;
}
#left:hover {
transform: rotate(-90deg) scale(1.3);
}
#right:hover {
transform: rotate(90deg) scale(1.3);
}
/*------MENU------*/
.menu-section {
background-color: #edb12f;
display: flex;
width: 100%;
top: -100px;
position: relative;
clip-path: polygon(0% 0%, 100% 3%, 100% 100%, 0% 100%);
}
.menu-section h1 {
font-size: 9.5rem;
margin-top: 0;
position: absolute;
left: 200px;
margin-top: -30px;
padding-top: 15px;
color: white;
font-family: 'Cedarville Cursive';
font-weight: bold;
}
.menu-line {
width: 450px;
height: 5px;
background-color: #17a832;
border-radius: 4px;
position: absolute;
top: 190px;
left: 195px;
}
.column-left, .column-right, .column-middle {
flex-basis: 33.33%;
margin-top: 230px;
padding-bottom: 50px;
}
.column-left {
display: flex;
justify-content: flex-end;
}
.column-left #combo-platter:after {
display: block;
content: "beans and rice included";
color: white;
font-size: 1.5rem;
font-family: 'Josefin Sans';
margin-top: -25px;
}
.column-left h2:not(#combo-platter):after, .column-middle h2:after, .column-right h2:after {
content: "";
display: block;
width: 100%;
height: 2px;
background-color: white;
border-radius: 3px;
margin-top: -25px;
}
.column-middle {
display: flex;
justify-content: center;
}
.column-right {
display: flex;
justify-content: flex-start;
}
.column {
min-width: 420px;
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
}
.column h2 {
display: inline-block;
align-self: center;
font-family: 'Cedarville Cursive';
color: #17a832;
font-size: 3rem;
}
.row {
font-family: 'Josefin Sans';
font-size: 1.5rem;
}
.row div {
display: flex;
justify-content: space-between;
}
.row div:after {
display: inline-block;
position: absolute;
content: "";
width: 100%;
margin-top: 33px;
border-top: 4px dotted black;
}
.row div p {
background: #edb12f;
overflow: hidden;
position: relative;
z-index: 1;
padding: 0 6px;
}
.burrito {
position: absolute;
transform: rotate(-45deg);
top: -20px;
right: 200px;
width: 300px;
height: 300px;
z-index: 11;
background-image: url(https://picsum.photos/id/1025/4951/3301);
}
.menu-h2 {
text-align: center;
}
.design-left, .design-right {
position: absolute;
}
.design-right {
right: 0;
transform: rotate(180deg);
}
.arrow-right {
width: 0;
height: 0;
border-top: 30px solid transparent;
border-bottom: 30px solid transparent;
border-left: 60px solid green;
position: relative;
top: -10px;
}
.arrow-left {
width: 0;
height: 0;
border-top: 30px solid transparent;
border-bottom: 30px solid transparent;
border-right:60px solid limegreen;
position: relative;
top: 20px;
}
.arrow-top {
width: 0;
height: 0;
border-top: 30px solid transparent;
border-bottom: 30px solid transparent;
border-left: 60px solid #20a04b;
position: relative;
top: -100px;
left: 60px;
}
.top-middle {
position: relative;
top: -110px;
}
.bottom-middle .arrow-left {
top: -40px;
}
.bottom-middle .move {
top: -70px;
}
.bottom {
position: relative;
top: -48px;
}
.bottom .arrow-left {
top: -40px;
}
/*------HOURS------*/
.hours-section {
background-color: green;
width: 100%;
height: 100px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mexican Restaurant</title>
<link href="https://fonts.googleapis.com/css?family=Cedarville+Cursive|Josefin+Sans|Kumar+One+Outline|Staatliches" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="header">
<div class="nav-wrap">
<div class="nav-box">
<div class="b1"></div>
<div class="b2"></div>
<div class="b3"></div>
</div>
<div class="menu">
Home
About
Menu
Hours
Contact
Location
<i class="fas fa-times" id="menu-close"></i>
</div>
</div>
<div class="info-wrap">
<p class="info">Authentic Mexican Food</p>
<div class="logo-wrap">
<div>YOUR</div>
<div>LOGO</div>
<div>HERE</div>
</div>
</div>
</div>
</header>
<main>
<div class="about-section">
<h1 class="about-h1">About Us</h1>
<div class="about-line"></div>
<div class="about-wrap">
<div class="about-info">
<p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestias voluptas pariatur consequuntur, repellat, laborum, rerum ipsum illo excepturi mollitia reprehenderit saepe nisi praesentium voluptate ab repellendus quos impedit, soluta natus dolore. Praesentium debitis odio cupiditate, reprehenderit alias. Sequi non beatae tempore fugit quia? Ratione aspernatur, quidem voluptates dignissimos Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque quo iure accusantium cupiditate hic, iste ab laborum incidunt neque a nihil, veritatis cumque quaerat, id laboriosam, labore eaque delectus perspiciatis.</p>
</div>
<div class="image-slider-wrap">
<div class="image-slider">
<i class="fas fa-sort-up" id="left"></i>
<i class="fas fa-sort-up" id="right"></i>
</div>
</div>
</div>
</div>
<div class="menu-section">
<div class="design-left">
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
</div>
</div>
<div class="design-right">
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
<div class="design-wrap">
<div class="top">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
<div class="arrow-top"></div>
</div>
<div class="top-middle">
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
<div class="bottom-middle">
<div class="arrow-right"></div>
<div class="arrow-left"></div>
<div class="arrow-right move"></div>
</div>
<div class="bottom">
<div class="arrow-left"></div>
<div class="arrow-top"></div>
</div>
</div>
</div>
<div class="burrito"></div>
<h1>Menu</h1>
<div class="menu-line"></div>
<div class="column-left">
<div class="column">
<h2 class="menu-h2" id="combo-platter">Combination Platters</h2>
<div class="row">
<div>
<p>2 Beef Tacos</p>
<p class="price">$6.99</p>
</div>
<div>
<p>2 Enchiladas</p>
<p class="price">$6.99</p>
</div>
<div>
<p>Tostada & Enchilada</p>
<p class="price">$6.99</p>
</div>
<div>
<p>Taco & Enchilada</p>
<p class="price">$6.99</p>
</div>
<div>
<p>Burrito & Enchilada</p>
<p class="price">$6.99</p>
</div>
<div>
<p>2 Beef Burritos</p>
<p class="price">$6.99</p>
</div>
<div>
<p>2 Carne Asada Tacos</p>
<p class="price">$6.99</p>
</div>
<div>
<p>Carne Asada</p>
<p class="price">$6.69</p>
</div>
<div>
<p>Chorizo</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Machaca</p>
<p class="price">$6.35</p>
</div>
<div>
<p>Carnitas</p>
<p class="price">$5.89</p>
</div>
<div>
<p>2 Fish Tacos</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Chiles Rellenos</p>
<p class="price">$5.95</p>
</div>
</div>
<h2 class="menu-h2">Burritos</h2>
<div class="row">
<div>
<p>Beef Burrito</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Pork Burrito</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Carne Asada Burrito</p>
<p class="price">$4.99</p>
</div>
<div>
<p>Chicken Burrito</p>
<p class="price">$5.49</p>
</div>
<div>
<p>California Burrito</p>
<p class="price">$6.69</p>
</div>
<div>
<p>Red Chili Burrito</p>
<p class="price">$4.89</p>
</div>
<div>
<p>Machaca Burrito</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Mixed Burrito</p>
<p class="price">$5.89</p>
</div>
<div>
<p>Chorizo Burrito</p>
<p class="price">$5.99</p>
</div>
<div>
<p>Bacon and Egg</p>
<p class="price">$4.99</p>
</div>
<div>
<p>Sausage and Egg</p>
<p class="price">$4.99</p>
</div>
<div>
<p>Chorizo and Egg</p>
<p class="price">$4.99</p>
</div>
<div>
<p>Picodegallo and Egg</p>
<p class="price">$4.99</p>
</div>
</div>
</div>
</div>
<div class="column-middle">
<div class="column">
<h2 class="menu-h2">Enchiladas</h2>
<div class="row">
<div>
<p>2 Cheese</p>
<p class="price">$4.55</p>
</div>
<div>
<p>2 Beef</p>
<p class="price">$4.65</p>
</div>
<div>
<p>2 Chicken</p>
<p class="price">$3.55</p>
</div>
</div>
<h2 class="menu-h2">Side Orders</h2>
<div class="row">
<div>
<p>Carne Asada Fries</p>
<p class="price">$4.55</p>
</div>
<div>
<p>Jalepenos</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Quesadilla</p>
<p class="price">$3.55</p>
</div>
<div>
<p>Ham Quesadilla</p>
<p class="price">$4.55</p>
</div>
<div>
<p>1/2 Pint of beans</p>
<p class="price">$4.65</p>
</div>
<div>
<p>1/2 Pint of rice</p>
<p class="price">$4.55</p>
</div>
<div>
<p>Super Nachos</p>
<p class="price">$4.65</p>
</div>
<div>
<p>1 Tamale</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Extra Cheese Quacamole</p>
<p class="price">$1.65</p>
</div>
<div>
<p>Supreme Quesadilla</p>
<p class="price">$3.95</p>
</div>
<div>
<p>Chips and Quacamole</p>
<p class="price">$1.65</p>
</div>
<div>
<p>1 Chiles Rellano</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Chips and salsa</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Churros</p>
<p class="price">$3.65</p>
</div>
</div>
<h2 class="menu-h2">Breafast Plates</h2>
<div class="row">
<div>
<p>Huevos Rancheros</p>
<p class="price">$6.55</p>
</div>
<div>
<p>Steaks Rancheros</p>
<p class="price">$6.65</p>
</div>
<div>
<p>Scrambled Eggs w/Ham</p>
<p class="price">$5.55</p>
</div>
<div>
<p>Scrambled Eggs w/Sausage</p>
<p class="price">$5.55</p>
</div>
<div>
<p>Chorizo Omelette</p>
<p class="price">$6.35</p>
</div>
<div>
<p>Carne Asada Omelette</p>
<p class="price">$6.45</p>
</div>
<div>
<p>Eggs and Bacon</p>
<p class="price">$3.55</p>
</div>
</div>
</div>
</div>
<div class="column-right">
<div class="column">
<h2 class="menu-h2">Drinks</h2>
<div class="row">
<div>
<p>Coca-cola</p>
<p class="price">$1.55</p>
</div>
<div>
<p>Jarrito</p>
<p class="price">$1.95</p>
</div>
<div>
<p>Sangria</p>
<p class="price">$1.95</p>
</div>
</div>
<h2 class="menu-h2">Tacos</h2>
<div class="row">
<div>
<p>Carne Asada Taco</p>
<p class="price">$2.55</p>
</div>
<div>
<p>Beef Taco</p>
<p class="price">$2.85</p>
</div>
<div>
<p>Pork Taco</p>
<p class="price">$2.85</p>
</div>
<div>
<p>Chicken Taco</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Fish Taco</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Carnita Taco</p>
<p class="price">$2.55</p>
</div>
<div>
<p>Cabeza Taco</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Adobada Taco</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Adobada Taco</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Adobada Taco</p>
<p class="price">$4.65</p>
</div>
</div>
<h2 class="menu-h2">Tortas</h2>
<div class="row">
<div>
<p>Carne Asada</p>
<p class="price">$4.09</p>
</div>
<div>
<p>Machaca</p>
<p class="price">$4.09</p>
</div>
<div>
<p>Ham</p>
<p class="price">$4.65</p>
</div>
<div>
<p>Chorizo</p>
<p class="price">$4.95</p>
</div>
<div>
<p>chicken</p>
<p class="price">$4.95</p>
</div>
</div>
<h2 Class="menu-h2">Tostadas</h2>
<div class="row">
<div>
<p>Pork</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Beef</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Fish</p>
<p class="price">$2.65</p>
</div>
<div>
<p>Carne Asada</p>
<p class="price">$2.65</p>
</div>
</div>
</div>
</div>
</div>
<div class="hours-section">
</div>
</main>
<footer>
</footer>
</body>
<script src="https://unpkg.com/scrollreveal"></script>
<script src="script.js"></script>
</html>
So I have an image of a burrito on the top of my menu section. the menu section has a clip-path: polygon property on it to make the top appear slanted. I want this burrito img to flow over the manu section so the top half is in the about section. This only works with z-index if the clip-path property is removed. Why? and how can I get around this? Thanks:)
I am trying to create a tube module for a tree grid. I want to keep the tube as one block and have each column as an element within the block. I would like to apply an offset to the tube so the tube below has an indent, but I'm running into an issue with the column borders lining up. How do I apply an offset to the first column of the block without applying it to the whole tube.
Here is the HTML:
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
And here is the SCSS:
.m-tube {
border: 1px solid silver;
border-radius: 3rem;
width: auto;
height: 3.5rem;
display: table;
&:hover {
background-color: lightblue;
}
&--no-end-cap {
border-radius: 3rem 0 0 3rem;
border-right: 0;
}
&__column {
border-right: 1px solid silver;
padding: 0 0.5rem;
height: 100%;
display: inline-table;
//vertical-align: middle;
&--no-border {
border-right: 0;
}
&--icon {
background-color: red;
height: 1.5rem;
width: 1.5rem;
}
}
&__text {
line-height: 3.4rem;
color: #01527a;
font-size: 1.1rem;
font-family: Helvetica, Arial, sans-serif;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
I'm having some issues with item alignment in IE and Safari and I'm not that good on cross-browser compatibility so would appreciate it if someone could suggest what I'm doing wrong with the following or what may be a good general fix.
Codepen: http://codepen.io/nickwcook/pen/vxjavM?editors=0110.
EDIT: Home image alignment sorted, but still having issues with the following:
The text in the About section of the page is fine in other browsers, but in IE its not taking into account the horizontal padding (30px) of the parent, and is actually overflowing past the sides of the viewport.
HTML:
<body ng-app="portfolioApp" data-spy="scroll" data-target="#navbar">
<div id="borderTop"></div>
<div id="borderRight"></div>
<div id="borderBottom"></div>
<div id="borderLeft"></div>
<div id="logo">
<img src="img/logo-basic-dark.png" alt="Logo">
</div>
<div class="container-fluid">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav pull-right">
<li class="navLink">Home</li>
<li class="navLink">About</li>
<li class="navLink">Work</li>
<li class="navLink">Contact</li>
</ul>
</div>
</nav>
</div>
<main>
<section id="home">
<div class="sectionContent">
<div id="homeText">
<h1 id="homePrimary">Home Text Primary</h1>
<h2 id="homeSecondary">Home Text Secondary</h2>
</div>
<div id="homeImageContainer">
<div id="homeImage" class="blend-red-blue">
<div id="homeImageMask"></div>
</div>
</div>
</div>
</section>
<section id="about" ng-controller="skillsController">
<div class="sectionContent">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-push-2">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div id="skillsList">
<p>My skills include:</p>
<p ng-repeat="skill in skills" class="skillItem">{{skill.name}}</p>
</div>
</div>
</div>
</div>
</section>
<section id="work" ng-controller="projectsController">
<div class="sectionContent">
<div class="row">
<div class="project col-xs-12 col-md-6 col-lg-3">
<div>
<h2>Project One</h2>
<h4>Project Description</h4>
<a ng-href="#" target="blank_">View Project</a>
</div>
</div>
<div class="project col-xs-12 col-md-6 col-lg-3">
<div>
<h2>Project One</h2>
<h4>Project Description</h4>
<a ng-href="#" target="blank_">View Project</a>
</div>
</div>
<div class="project col-xs-12 col-md-6 col-lg-3">
<div>
<h2>Project One</h2>
<h4>Project Description</h4>
<a ng-href="#" target="blank_">View Project</a>
</div>
</div>
<div class="project col-xs-12 col-md-6 col-lg-3">
<div>
<h2>Project One</h2>
<h4>Project Description</h4>
<a ng-href="#" target="blank_">View Project</a>
</div>
</div>
</div>
</div>
</section>
<section id="contact">
<div class="sectionContent">
</div>
</section>
</main>
</body>
CSS:
/* GENERAL LAYOUT */
html, body
{
padding: 0;
margin: 0;
background-color: #fefefe;
overflow-x: hidden;
}
/* SECTIONS */
section
{
display: block;
margin: 0;
background: transparent;
z-index: 90;
}
.sectionContent
{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 100px 30px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
/* HOME SECTION */
#home #homeImageContainer
{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#home #homeImage
{
position: absolute;
height: 30vw;
width: 30vw;
background-image: url('../img/laptop-hands.png');
background-position: center center;
background-size: cover;
z-index: 90;
-webkit-box-shadow: 3px 3px 100px 4px rgba(153,153,153,1);
-moz-box-shadow: 3px 3px 100px 4px rgba(153,153,153,1);
box-shadow: 3px 3px 100px 4px rgba(153,153,153,1);
}
#home #homeImage > #homeImageMask
{
height: 100%;
width: 100%;
background-color: rgba(84, 17, 200, 0.6);
z-index: 91;
}
#home #homeText
{
z-index: 95;
}
#homeText h1#homePrimary,
#homeText h2#homeSecondary
{
color: #000;
text-align: center;
}
#homeText h1#homePrimary
{
font-size: 30px;
font-weight: 600;
margin-bottom: 10px;
}
#homeText h2#homeSecondary
{
font-family: 'Open Sans', sans-serif;
font-size: 16px;
font-weight: 600;
}
/* ABOUT SECTION */
#about p
{
line-height: 26px;
text-align: center;
}
#about #skillsList
{
width: 100%;
text-align: center;
margin-top: 50px;
}
#about #skillsList p:first-of-type
{
margin-bottom: 10px;
}
#about #skillsList p.skillItem
{
display: inline;
margin: 0 15px;
}
what about simplifying like this:
body, h1, h2 {
margin: 0;
}
.box-content {
width: 30vw;
height: 30vw;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 100px 30px;
box-sizing: border-box;
background: rgba(84, 17, 200, 0.6);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
box-shadow: 3px 3px 100px 4px rgba(153, 153, 153, 1);
text-align: center;
}
<div class="sectionContent">
<div id="homeText" class="box-content">
<h1 id="homePrimary">Home Text Primary</h1>
<h2 id="homeSecondary">Home Text Secondary</h2>
</div>
</div>
You can remove absolute css property from selector '#home #homeImage' issue is fixed at my end
I would like the overlay content to come from bottom of the image when hovered, but for some reason it's always visible, am I missing something with positioning? Here's the pen: http://codepen.io/anon/pen/PbjVgy
* {
background-color: grey;
color: white;
}
.about__images {
max-width: 800px;
margin: 0 auto;
}
.about__inner {
margin-top: 60px;
}
.about__inner img {
max-width: 100%;
margin-right: 20px;
}
/**/
.about .about__inner {
position: relative;
}
.about .about__inner .about__inner--overlay {
position: absolute;
top: 100%;
left: 15px;
text-align: center;
background: rgba(0, 0, 0, 0.8);
width: 89%;
height: 100%;
transition: all 0.1s ease-in;
}
p {
margin-top: 60px;
}
.about .about__inner:hover .about__inner--overlay {
top: 0;
}
<section class="about">
<h5 class="small__title">Lorem ipsum</h5>
<p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae commodi nisi aut animi, excepturi impedit dicta natus culpa. Veniam atque sapiente assumenda fugiat tempore ipsam eos quae</p>
<div class="container">
<div class="about__images">
<div class="row">
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=37&txt=390%C3%97259&w=390&h=259" alt="">
<div class="about__inner--overlay">
<p>overlay content</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=37&txt=390%C3%97259&w=390&h=259" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>overlay content</p>
</div>
</div>
<div class="about__inner col-md-4">
<img src="https://placeholdit.imgix.net/~text?txtsize=37&txt=390%C3%97259&w=390&h=259" alt="">
<div class="about__inner--overlay">
<i class="fa fa-user" aria-hidden="true"></i>
<p>overlay content</p>
</div>
</div>
</div>
</div>
</div>
</section>
Add overflow: hidden to .about__inner
.about__inner {
margin-top: 60px;
overflow: hidden;
}
http://codepen.io/anon/pen/ENXMxW