I'm working on a personal project and I have a problem with overlapping when I resize the window.
Basically until now my page is divided in 3 sections, header (which is sticky), middle/hero and last section with the products.
The problem is when I make my page less higher, the images with the coffees are overlapping the text.
My code is here:
display: grid;
grid-template-columns: repeat(auto-fit, minmax(20em, 1fr));
height: calc(100vh - 64px);
width: calc(100vw - 64px);
justify-content: center;
}
.text-section {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
font-size: 1.05em;
margin: 0 5vw 0 5vw;
padding: 0 2vw 0 2vw;
}
.text-section h2 {
font-size: 2em;
font-weight: 600;
padding-bottom: 1em;
}
/* <p> color */
.ph {
color: #3c4043;
}
.image-section {
display: flex;
align-items: center;
justify-content: center;
background-image: url(https://www.illy.com/dw/image/v2/BBDD_PRD/on/demandware.static/-/Sites-masterCatalog_illycaffe/default/dw9a7f00e7/products/Coffee/Coffee-Ground/9893ME_coffee_ground-espresso_can-classico-roast-250gr-zagnoli-decorated_illy-shop/DecoratoOZ_GroundClassico_800x800px.png);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
min-height: 15em;
margin: 2vw;
}
.main-body {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
justify-content:space-between;
}
.illy,
.lavazza,
.starbucks {
display: flex;
flex-direction: column;
align-items: center;
width: 15em;
height: 25em;
}
https://codepen.io/claudiuu/full/ZEWmRzR
here is the overlap
Related
The left most item is not aligned with the rest of the items. How to i center them correctly?
.activities{
display: flex;
align-items: center;
flex-direction: column;
padding-top: 25px;
background-color: #F3FAEF;
text-align: center;
}
.activities-image{
border-radius: 50%;
width: 150px;
height: 150px;
}
.activities-header{
font-size: 18px;
font-weight: bold;
}
.activities-cols{
display: flex;
align-items: center;
text-align: center;
}
.activity-col{
border: 1px solid red;
width: 330px;
height: 330px;
}
Demo: https://codepen.io/AdanRod133/pen/jOxPBEX
Full-page: https://codepen.io/AdanRod133/full/jOxPBEX
.activity-col {
border: 1px solid red;
width: 330px;
height: 330px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
The dark gray area is clickable but the blue margin has no action. How can I expand the rest of the smaller sized items to fill in the space?
div.scrollmenu {
display:flex;
justify-content: flex-start;
align-items: center;
background-color: #333;
overflow: auto;
flex-wrap: nowrap;
}
div.scrollmenu a {
display: flex;
color: white;
text-align: left;
padding: 14px;
text-decoration: none;
margin: auto;
min-width: 25%;
max-width: 25%;
}
Add the align-items: stretch; property to your div.scrollmenu and tweak your code a bit.
div.scrollmenu {
display:flex;
/* align-items: stretch; */ /* redundant */
background-color: #333;
flex-wrap: nowrap;
}
div.scrollmenu a {
display: flex;
align-items: center;
/* uncomment this if you want them to be centered horizontally */
/*justify-content: center;*/
padding: 1 14px;
color: white;
text-align: left;
text-decoration: none;
flex: 1;
}
Hope this helps.
EDIT You don't even need align-items: stretch because I believe that's the default property since the result is the same even if you leave it out.
I am trying to remove the text-decoration of a flex child when the parent is the anchor. I've tried all of the following code, and it is not working at all. I've created a jsFiddle, and on that the underline shows all the time and not on hover. In my WordPress installation, it only shows on hover. I'm really not sure what to do! Any help is appreciated!
Thank you ahead of time!!!!
.fleximagebox_link:hover, a.fleximagebox_link:hover, a .fleximagebox_link:hover,
.fleximagebox_link a:hover, .fleximagebox_link:hover a,
a .fleximagebox_link p:hover, .image_background:hover, .image_background:hover a,
a .image_background:hover, .image_background.fleximagebox_link a:hover,
a .image_background.fleximagebox_link:hover {
text-decoration: none!important;
}
Here is the jsFiddle that explains what I'm talking about: https://jsfiddle.net/Clare12345/th60mde3/2/
This will get rid of the underline in your fiddle .flexbox_images a { text-decoration: none; }
As to why it's on your website, all we can do is guess if you don't include the code or a link to your site. But you might try changing that line to .flexbox_images a, .flexbox_images a:hover { text-decoration: none !important; }
.flexbox_images a {
text-decoration: none;
}
.main_box {
background: white;
height: 400px;
width: 100%;
margin: 0 auto;
padding: 0px;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
overflow: hidden;
}
.main_box .flexbox_images {
color: white;
width: 100%;
padding: 0px;
overflow: auto;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flexbox_images a {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
width: 100%;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.image_background {
height: 250px;
margin: 0 auto;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
max-width: 101%;
}
.image_background_left {
background-repeat: no-repeat;
background-size: contain;
background-image: url(http://pipsum.com/350x240.jpg);
justify-content: flex-end;
margin-right: -1px;
}
.image_background_right {
background-repeat: no-repeat;
background-size: contain;
background-image: url(http://pipsum.com/350x240.jpg);
justify-content: flex-start;
margin-left: -1px;
}
.fleximagebox_link {
font-size: 28pt;
background: rgba(255, 255, 255, 0.85);
color: #000!important;
text-transform: uppercase;
font-weight: 900;
letter-spacing: 1.5px;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
width: 130px;
}
.image_background_left .fleximagebox_link {
justify-content: flex-end;
padding-left: 35px;
}
.image_background_right .fleximagebox_link {
justify-content: flex-start;
padding-right: 35px;
}
.image_background_right .fleximagebox_link p {
font-size: 28pt!important;
color: #000!important;
text-transform: uppercase;
font-weight: 900;
letter-spacing: 1.5px;
margin-bottom: 0px;
}
.main_black_bar {
width: 3px;
background: #000;
height: 50px;
margin-top: 15px;
margin-bottom: 15px;
margin-left: -1px;
}
.image_background_left .main_black_bar {
margin-left: 35px;
}
.image_background_right .main_black_bar {
margin-right: 35px;
}
<div class="main_box">
<div class="flexbox_images">
<a href="">
<div class="image_background image_background_left">
<div class="fleximagebox_link">Buy
<div class="main_black_bar"> </div>
</div>
</div>
</a>
<a href="">
<div class="image_background image_background_right">
<div class="fleximagebox_link">
<div class="main_black_bar"> </div>Sell</div>
</div>
</a>
</div>
</div>
I have a container with several elements inside. I want to center these elements vertically, as a group. Can this be done with flexbox and if so, how?
Here is a demo:
.container {
margin: 0 auto;
width: 700px;
height: 600px;
background: #ebebeb;
flex-direction: column;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-align: center;
-webkit-align-items: center;
-webkit-box-align: center;
align-items: center;
}
.btn {
display: inline-block;
padding: 5px 10px;
padding: 0.3125rem 0.625rem;
background: #129c87;
color: #fff;
border: 1px solid #999;
border-radius: 2px;
font-weight: 600;
text-align: center;
outline: none;
border: none;
cursor: pointer;
font-family: Arial;
}
<div class="container">
<h1>Center me and my paragraphs plz</h1>
<p>First paragraph is always first</p>
<p>Then comes the second</p>
<a class="btn" href="#">Read more</a>
</div>
You just need justify-content:center;
fiddle: https://jsfiddle.net/w64ks4x7/
.container {
margin: 0 auto;
width: 700px;
height: 600px;
background: #ebebeb;
flex-direction: column;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-align: center;
-webkit-align-items: center;
-webkit-box-align: center;
align-items: center;
justify-content:center;
}
This is a simple question. I must be just missing the answer. I have a flex container with one flex item in it. I want the flex item to be 90% wide and centered vertically and horizontally. I just can't get it to be 90% wide. I am puzzled. Here's my code:
<div class="" id="popupContainer">
<div class="flex-item-popup" id="popup">
</div>
</div>
#popupContainer {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display:flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-content: flex-start;
align-items: center;
}
#popup {
width: 90%;
height: 90%;
flex-grow: 1;
flex-shrink: 0;
flex-basis: 200px;
justify-content: center;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-flex-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
background-color: black;
justify-content: center; /* align horizontal */
align-items: center; /* align vertical */
}
just delete these two and it will work proprely :
flex-grow: 1; flex-basis: 200px;
Live Demo