Setting modals size to 100% - html

I have created a modal inside a button-container which utilizes some flex display elements.
The problem occurs when I want to size the .modal-mask to a 100% of width/height to the whole page (body) size which is my goal here, I can't seem to get it to adjust properly without disturbing my button-container elements.
In short, I want the inner div .modal-mask to be sized 100% to the body
Project Fiddle: https://jsfiddle.net/est857q0/
HTML:
<ul id="button-container">
<li>
<a id="html-modal-button" #click="showModal = 'html-modal'">
<img class="htmllogo" src="http://sweettutos.com/wp-content/uploads/2015/12/placeholder.png">
</a>
<htmlmodal v-if="showModal === 'html-modal'" #close="showModal = false"></htmlmodal>
</li>
<li>
<a id="cs-modal-button" #click="showModal = 'cs-modal'">
<img class="csharplogo" src="http://sweettutos.com/wp-content/uploads/2015/12/placeholder.png">
</a>
<csmodal v-if="showModal === 'cs-modal'" #close="showModal = false"></csmodal>
</li>
</ul>
<!-- MODAL SECTION -->
<script type="text/x-template" id="html-modal-template">
<transition name="html-modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-content">
<slot name="body">
<button class="modal-default-button" #click="$emit('close')">HTML CLOSE</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<script type="text/x-template" id="cs-modal-template">
<transition name="cs-modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-content">
<slot name="body">
<button class="modal-default-button" #click="$emit('close')">CS CLOSE</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
CSS:
/*Global*/
html {
margin-right: calc(100% - 100vw);
/*overflow: hidden;*/
}
body {
margin: 0 auto;
background-image: url('../images/wallpaper.jpg');
font-family: 'Josefin Sans', sans-serif;
}
*::selection {
background-color: red;
}
/*Header*/
h1 {
text-transform: uppercase;
width: 100%;
font-size: 9vw;
text-align: center;
margin-top: 4vh;
}
/*Containers*/
#button-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
margin-top: 40vh;
margin-left: 50vw;
transform: translate(-50%, -70%);
width: 90vw;
height: 45vh;
align-items: baseline;
background: linear-gradient(to right, transparent 0%, #fff 33%, #fff 66%, transparent 100%);
}
#button-container li {
position: relative;
display: inline-block;
cursor: pointer;
}
#button-container .html-text-block,
.cs-text-block {
position: absolute;
bottom: 4px;
width: 100%;
height: 30%;
box-sizing: border-box;
background-color: #fff;
padding-left: 5px;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
transition: box-shadow 0.5s cubic-bezier(.25, .8, .25, 1), transform 0.5s cubic-bezier(.25, .8, .25, 1);
}
#button-container .htmllogo,
#button-container .csharplogo {
width: 150px;
}
#button-container {
border: 1px solid #000;
}
img:hover {
transform: scale(1.1);
}
/* THE MODAL CSS SECTION */
/*Main Modal container*/
.modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: middle;
}
.modal-container {
width: 300px;
margin: 0px auto;
padding: 20px 30px;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
.modal-content {
margin: 20px 0;
}
I attempted to set the button-container too 100% : https://jsfiddle.net/est857q0/ yet this messes up the flow

Related

Div is smaller than the content of the Div

I've a DIV, with a button inside. Under this DIV, I've a hr, but the hr isn't under the button. I could make the DIV height bigger, but I don't know how high the button is (it depends on the browser). Can I style the DIV, that all things, which are in the code under the DIV, on the website also under the DIV are? I show below my HTML and the CSS code, and a screenshot from the result.
body {
min-height: 100vh;
}
/* centering the div that is supposed to take all content */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
#wrapper {
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
}
#output {
display: inline-block;
}
/* make button sit on the right side */
#copy {
float: right;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>
Is your problem that you want the hr to be placed under the button? Then, applying a width: 100% to it could be a solution. But it depends on the final result you're looking for.
* {
font-family: sans-serif;
color: white;
}
/* Schriftart (Sansserif), Weiss */
body {
background-image: url(img.jpg);
background-position: center;
background-size: cover;
min-height: 100vh;
}
/* positioning background image */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
/* centering the div that is supposed to take all content */
#wrapper {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
width: 100%;
}
#output {
display: inline-block;
}
#copy {
float: right;
}
/* make button sit on the right side */
button {
background-color: rgb(132, 60, 116);
border: none;
padding: 8px;
border-radius: 10px;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>
Just add
#top {
display: flex;
flex-direction: column;
}
Here is the result
* {
font-family: sans-serif;
color: white;
}
/* Schriftart (Sansserif), Weiss */
body {
background-image: url(img.jpg);
background-position: center;
background-size: cover;
min-height: 100vh;
}
/* positioning background image */
#center {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
/* centering the div that is supposed to take all content */
#wrapper {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.1);
border-radius: 50px;
box-shadow: -1px 0px 20px 0px rgba(0, 0, 0, 1);
height: 75vh;
padding: 50px;
width: 75vh;
}
hr {
border-style: none;
border-top: 1px solid black;
}
#output {
display: inline-block;
}
#copy {
float: right;
}
/* make button sit on the right side */
button {
background-color: rgb(132, 60, 116);
border: none;
padding: 8px;
border-radius: 10px;
}
#top {
display: flex;
flex-direction: column;
}
<div id="center">
<div id="wrapper">
<div id="top">
<div id="output"></div>
<div id="copy"><button>kopieren</button></div>
</div>
<hr>
</div>
</div>

Why can't i align the div that contains text next to the div that contains the image

i'm currently working on a webpage for my design class and i have a problem. This is the browser view:
I am kinda new with html and css but i have tried display in-line block, flex... Nothing worked, and i dont know what else i could do
So the problem is that the text "aaaaa" must be next to image. Here is my html code:
.caixa {
word-wrap: break-word;
width: 70%;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
margin: 25px;
margin-left: 0px;
border-radius: 10px;
}
.caixa-img {
display: inline-block;
margin: 15px;
width: 15%;
position: relative;
}
.caixa-img img {
margin-right: 120px;
border-radius: 10px;
width: 100%;
height: 100%;
}
.info {
width: 100%;
padding: 10px 20px;
}
.tipo {}
.descripcio {
display: block;
background-color: chartreuse;
}
.tipo a {
color: #222222;
margin: 5px 0px;
font-weight: 700;
letter-spacing: 0.5px;
padding-right: 8px;
}
.tipo span {
color: rgba(26, 26, 26, 0.5);
}
.preu {
color: #333333;
font-weight: 600;
font-size: 1.1rem;
font-family: poppins;
letter-spacing: 0.5px;
}
.overlay {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: rgba(226, 197, 88, 0.6);
display: flex;
justify-content: center;
align-items: center;
}
.comprar {
width: 160px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
color: #252525;
font-weight: 700;
letter-spacing: 1px;
font-family: calibri;
border-radius: 20px;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
}
.comprar:hover {
color: #FFFFFF;
background-color: rgb(248, 171, 55);
transition: all ease 0.3s;
}
.overlay {
visibility: hidden;
}
.caixa-img:hover .overlay {
visibility: visible;
animation: fade 0.5s;
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="col-12 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
<!--
<div class="rating">
<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>-->
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
Below an example using flexbox (see .caixa).
.caixa {
width: 70%;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
margin: 25px 25px 25px 0;
/* margin-left: 0px; */
border-radius: 10px;
display: flex; /* Added */
}
.caixa-img {
margin: 15px;
width: 30%;
}
.caixa-img img {
border-radius: 10px;
width: 125px; /* For demo */
height: 125px; /* For demo */
}
.info {
width: 100%;
padding: 10px 20px;
}
.tipo {}
.descripcio {
display: block;
background-color: chartreuse;
word-break: break-all; /* Essential to break large words */
}
.tipo a {
color: #222222;
margin: 5px 0px;
font-weight: 700;
letter-spacing: 0.5px;
padding-right: 8px;
}
.tipo span {
color: rgba(26, 26, 26, 0.5);
}
.preu {
color: #333333;
font-weight: 600;
font-size: 1.1rem;
font-family: poppins;
letter-spacing: 0.5px;
}
.overlay {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: rgba(226, 197, 88, 0.6);
display: flex;
justify-content: center;
align-items: center;
}
.comprar {
width: 160px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
color: #252525;
font-weight: 700;
letter-spacing: 1px;
font-family: calibri;
border-radius: 20px;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
}
.comprar:hover {
color: #FFFFFF;
background-color: rgb(248, 171, 55);
transition: all ease 0.3s;
}
.overlay {
visibility: hidden;
}
.caixa-img:hover .overlay {
visibility: visible;
animation: fade 0.5s;
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="col-12 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
if you use boostrap framework
you can use the bootstrap column and row.
<!-- language: lang-html -->
<div class="row">
<div class="col-6 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
</div>
<div class="col-6">
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
<!--
<div class="rating">
<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>-->
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
</div>
<!-- end snippet -->
You have too much nested divs that dont need to be there, just making it more complex.
Also, your text is going outside your div borders, this is not a good thing.
You can move your text next to the image by using flex.
You always apply flex on a parent of the element that you want to move around (in this case, div with a picture, and div with a text).
So you are going to apply flex to a div that holds both of those divs (div with image, and div with text).
Here is my solution to this problem on a simple example, it should help you :
https://codepen.io/Juka99/pen/YzGVQyv

how to get circular menu (incl. hover + link functionality) fully responsive?

I am trying to get a circular menu (incl. hover + link functionality) to behave fully responsible.
The hovering and linking part basically is working fine.
Without the hovering part, the circular menu behaves responsive.
But with the hovering part included, the menu gets squeezed when display/screen width is adjusted.
I have tried the #media approach, setting different width and height in .ch-grid li for different screen widths, but that is not to be considered as a true solution, is merely a temporary workaround.
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
#test1 {
display: -webkit-flex;
display: flex;
text-align: center;
justify-content: space-between;
margin-bottom: 30px;
margin-left: 35px;
margin-right: 35px;
}
#test2 {
width: 15%;
text-align: center;
position: relative;
border-radius: 50%;
overflow: hidden;
background-color: #ff0082;
}
ul li img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
object-fit: cover;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 90px;
display: inline-block;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.4s ease-in-out;
}
.ch-info {
position: absolute;
background: rgba(63, 147, 147, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
}
.ch-info p {
color: #fff;
padding: 13px 0px;
font-style: normal;
font-size: 9px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
font-size: 140%;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
<ul id="test1" class="ch-grid">
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_hansie_hansumus.jpg" />
<div class="ch-info">
<p>Hansie<BR>Hansumus</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_missie_marble.jpg" />
<div class="ch-info">
<p>Missie<BR>Marble</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_piotr_linski.jpg" />
<div class="ch-info">
<p>Piotr<BR>Linski</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_red.jpg" />
<div class="ch-info">
<p>Mister<BR>Red</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_green.jpg" />
<div class="ch-info">
<p>Miss<BR>Green</p>
</div>
</div>
</li>
<li id="test2">
<div class="ch-item">
<img src="https://gespreksmakers.nl/images/1_blue.jpg" />
<div class="ch-info">
<p>Mister<BR>Blue</p>
</div>
</div>
</li>
</ul>
A fiddle, showing the present CSS- and HTML-code can be found here: https://jsfiddle.net/piotrlinski/b3tL9v4h/8/
Any suggestions how to solve?
The class attribute can be used with multiple HTML elements/tags and
all will take the effect. Where as the id is meant for a single
element/tag and is considered unique. Moreoever the id has a higher
specificity value than the class.
Responsive image:
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
An unordered list:
<ul class="thumbnails">
<li>Thumbnail 1</li>
<li>Thumbnail 2</li>
<li>...</li>
</ul>
List unstyled in one line with display: flex:
.thumbnails {
display: flex;
list-style: none;
...
}
Structure of a thumbnail
<a href="https://nkbv.nl" class="thumbnail">
<img src = "https://gespreksmakers.nl/images/1_hansie_hansumus.jpg"/>
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
where .thumbnail has position: relative and .overlay has position: absolute so that .overlay is in the same area as .thumbnail.
Make font size responsive with vw.
A modified and clear solution
.thumbnails {
display: flex;
list-style: none;
padding: 0 2vw;
}
.thumbnails>li {
flex: 1 0;
margin: 0 5px;
text-align: center;
line-height: 0;
}
.thumbnail,
.thumbnail>img,
.thumbnail>.overlay {
border-radius: 50%;
}
.thumbnail {
position: relative;
display: inline-block;
cursor: pointer;
}
/* Responsive images */
.thumbnail>img {
display: block;
max-width: 100%;
height: auto;
}
.thumbnail>.overlay {
background: rgba(63, 147, 147, 0.8);
opacity: 0.7;
position: absolute;
top: 0;
height: 100%;
width: 100%;
transform: scale(0);
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
transition: all 0.4s ease-in-out;
}
.thumbnail>.overlay>.text {
color: white;
width: 66.66%;
line-height: 100%;
margin: 0 auto;
padding: 5px 0;
border-bottom: 1px solid;
border-top: 1px solid;
font-size: 1.85vw;
transition: opacity 1s ease-in-out 0.4s;
opacity: 0;
}
.thumbnail:hover>.overlay {
transform: scale(1);
}
.thumbnail:hover>.overlay>.text {
opacity: 1;
}
<ul class="thumbnails">
<li>
<a href="https://nkbv.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_hansie_hansumus.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://kakivi.de" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_missie_marble.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://telegraaf.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_piotr_linski.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.tukhut.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_red.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.alumnei.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_green.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
<li>
<a href="https://www.astronieuws.nl" class="thumbnail">
<img src="https://gespreksmakers.nl/images/1_blue.jpg" />
<div class="overlay">
<p class="text">Mister White</p>
</div>
</a>
</li>
</ul>
You may check my code below though I have made kind of lots of changes.
Some tips:
IDs must be unique in the HTML document, so you should not use an ID more than once (e.g. #test2).
Also, it is better to use the classes you created to style your document, rather than the IDs (e.g. #test1, #test2 could be replaced by .ch-grid and .ch-grid li, respectively).
<style>
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
.ch-grid {
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
text-align: center;
}
.ch-grid:after,
.ch-item:before {
content: "";
display: table;
}
.ch-grid:after {
clear: both;
flex: auto;
}
.ch-grid li {
flex: 1;
display: inline-block;
min-width: calc(100% / 6);
max-width: calc(100% / 6);
position: relative;
background-color: #ff0082;
overflow: hidden;
border-radius: 50%;
text-align: center;
}
.ch-grid li img {
width: 100%;
height: 100%;
object-fit: cover;
position: relative;
z-index: 10;
}
.ch-item {
position: relative;
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6),
0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out;
}
.ch-info {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: -webkit-flex;
display: flex;
flex-direction: column;
justify-content: center;
background: rgba(63, 147, 147, 0.8);
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
z-index: 20;
}
.ch-info p {
color: #fff;
padding: 13px 0px;
font-style: normal;
font-size: 9px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
font-size: 140%;
letter-spacing: 1px;
padding-top: 4px;
font-family: "Open Sans", Arial, sans-serif;
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1),
0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
#media (max-width: 767px) {
.ch-grid li {
min-width: calc(100% / 3);
max-width: calc(100% / 3);
}
}
</style>
If you set width over percentage, the list items will not seem as a circle depending the screen width. Because of this situation, you should set fixed width to the list items and set wrap to parent as you can see below:
#test1 {
display: -webkit-flex;
display: flex;
text-align: center;
justify-content: space-between;
flex-wrap: wrap;
margin-bottom: 30px;
margin-left: 35px;
margin-right: 35px;
}
#test2 {
flex-basis: 85px;
text-align: center;
position: relative;
border-radius: 50%;
overflow: hidden;
background-color: #ff0082;
}

bootstrap card overlaps on top of each other on mobile screen

So i have one "flipping card" and another bootstrap 4 card side by side like this: (I have edited the image to hide text)
However when this is tested on target mobile screen using chrome's dev consolde, The 2nd Card overlaps the flipping card and completely covers it. like this:
I have put the code inside the container, row and col-md-* like this:
<div class="container">
<div class="row">
<div class="col-md-4">
</div>
....
<div class="col-md-8">
</div>
</div>
</div>
For full refrence, here is my full html and css code:
html:
<!-- start of third block -->
<div class="thirdblock">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card-container">
<div class="card">
<div class="front">
<div class="cover">
</div>
<div class="user">
<img class="img-circle" src="images/...jpg" />
</div>
<div class="content">
<div class="main">
<h3 class="name">.</h3>
<p class="profession">.</p>
<p class="">..
<div class="text-center">
<i class="fa fa-mail-forward"></i> Flip
</div>
</p>
</div>
</div>
</div> <!-- end front panel -->
<div class="back">
<div class="content">
<div class="main">
<p> </p>
<p class="lead">
.</p>
<p> </p>
<br>
<div class="stats-container">
<div class="stats">
<h4>100+</h4>
<p>
Followers
</p>
</div>
<div class="stats">
<h4>10+</h4>
<p>
Following
</p>
</div>
<div class="stats">
<h4>100+</h4>
<p>
Projects
</p>
</div>
</div>
</div>
</div>
</div> <!-- end back panel -->
</div> <!-- end card -->
</div> <!-- end card-container -->
</div> <!-- end col-md-4 -->
<div class="col-md-8">
<div class="card">
<div class="card-body">
<h4> </h4>
<p class="lead">
</p>
<img class="rounded mx-auto d-block" src="images/....png" />
<br>
</div>
</div>
</div>
</div><!-- end row -->
</div> <!-- end container -->
</div>
<!-- end third block -->
And the huge css code:
.thirdblock {
padding-top: 50px;
padding-bottom: 50px;
height: 100%;
font-family: 'Arima Madurai', cursive;
background-image: url("../images/image.jpg");
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.card {
font-family: 'Arima Madurai', Verdana;
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 4px;
color: #444444;
-webkit-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
-moz-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
}
/*Flipping Card Code*/
/*Flip Card Starts*/
.btn:hover,
.btn:focus,
.btn:active {
outline: 0 !important;
}
/* entire container, keeps perspective */
.card-container {
-webkit-perspective: 900px;
-moz-perspective: 900px;
-o-perspective: 900px;
perspective: 900px;
margin-bottom: 3px;
}
/* flip the pane when hovered */
.card-container:not(.manual-flip):hover .card,
.card-container.hover.manual-flip .card {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.card-container.static:hover .card,
.card-container.static.hover .card {
-webkit-transform: none;
-moz-transform: none;
-o-transform: none;
transform: none;
}
/* flip speed goes here */
.card {
-webkit-transition: -webkit-transform .5s;
-moz-transition: -moz-transform .5s;
-o-transition: -o-transform .5s;
transition: transform .5s;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.front,
.back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
background-color: #FFF;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.14);
}
/* front pane, placed above back */
.front {
z-index: 2;
}
/* back, initially hidden pane */
.back {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
z-index: 3;
}
.back .btn-simple {
position: absolute;
left: 0;
bottom: 4px;
}
/* Style */
.card-container,
.front,
.back {
width: 100%;
border-radius: 4px;
-webkit-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
-moz-box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
box-shadow: 0px 0px 19px 0px rgba(0, 0, 0, 0.16);
margin-bottom: 50px;
}
.card .cover {
height: 105px;
overflow: hidden;
border-radius: 4px 4px 0 0;
}
.card .cover img {
width: 100%;
}
.card .user {
border-radius: 50%;
display: block;
height: 120px;
margin: -55px auto 0;
overflow: hidden;
width: 120px;
}
.card .user img {
width: 100%;
}
.card .content {
background-color: rgba(0, 0, 0, 0);
box-shadow: none;
padding: 10px 20px 20px;
}
.card .content .main {
min-height: 100%;
}
.card .back .content .main {
height: 100%;
}
.card .name {
font-family: 'Arima Madurai', cursive;
font-size: 22px;
line-height: 28px;
margin: 10px 0 0;
text-align: center;
text-transform: capitalize;
}
.card h5 {
margin: 5px 0;
font-weight: 400;
line-height: 20px;
}
.card .profession {
color: #999999;
text-align: center;
margin-bottom: 20px;
}
.card .fofooter-toter {
border-top: 1px solid #EEEEEE;
color: #999999;
margin: 30px 0 0;
padding: 10px 0 0;
text-align: center;
}
.card .footer-t .social-links {
font-size: 18px;
}
.card .footer-t .social-links a {
margin: 0 7px;
}
.card .footer-t .btn-simple {
margin-top: -6px;
}
.card .header {
padding: 15px 20px;
height: 90px;
}
.card .motto {
font-family: 'Arima Madurai', cursive;
border-bottom: 1px solid #EEEEEE;
color: #999999;
font-size: 14px;
font-weight: 400;
padding-bottom: 10px;
text-align: center;
}
.card .stats-container {
width: 100%;
margin-top: 50px;
}
.card .stats {
display: block;
float: left;
width: 33.333333%;
text-align: center;
}
.card .stats:first-child {
border-right: 1px solid #EEEEEE;
}
.card .stats:last-child {
border-left: 1px solid #EEEEEE;
}
.card .stats h4 {
font-family: 'Arima Madurai', cursive;
font-weight: 300;
margin-bottom: 5px;
}
.card .stats p {
color: #777777;
}
Can someone please help me as in what am i messing up?
just add fixed height for your .card class, because of position absolute on .front and .back classes, card class won't take any height.
.card{
height:362px;
}
Remove the CSS for class
.front,.back
/* position: absolute; */
/* top: 0; */

Cannot reduce div height without having visualization issues

in this codepen:https://codepen.io/anon/pen/GGrVdK
I cannot reduce the height of the div having class foul-row to 4px height, given that every foul div is 4px tall.
.foul{
background: linear-gradient(to bottom right, rgb(0,0,0), rgb(92,92,92));
height: 4px;
margin-top:0;
margin-bottom: 0;
margin-right: 2px;
width: 15px;
display: inline-block;
}
If I try to set a height to foul-row class, either I have scrollbars in the containing cell div, or I can't see foul divs.
Here there is cell class
.cell{
padding: 6px 8px 0 8px;
white-space: nowrap;
font-size: 13px;
min-width: 27px;
display: block;
overflow: auto;
height: 36px; /*I would like to remove this, but if I do, I have visualization problems*/
}
and this is the structure of the "incriminated" cell
<div class="cell white">
<div>Home Team</div>
<div class="foul-row">
<div class="foul"></div><div class="foul"></div><div class="foul">/div><div class="foul"></div><div class="foul"></div>
</div>
</div>
How can I reduce foul-row height to fit foul height and reduce the total height of cell div? Thanks
Your height:4px is being overriteen by the font-size, which is by default 16px,because it needs to have space for the text to show up.
Now since div.foul doesn't have any text it will be fine to set it's font to 0.
body {
font-family: 'Fjalla One', sans-serif;
text-transform: uppercase;
letter-spacing: 0.02em;
/* background-image: url(https://dynamitick.com/wp-content/uploads/2018/01/legnano-basket-19-sempione-news.jpg); */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
height: 100%;
}
.red {
background-color: rgba(255, 0, 0, 0.7);
color: white;
}
.blue {
background-color: rgba(0, 0, 255, 0.7);
color: white
}
.black {
background-color: rgba(0, 0, 0, 0.7);
color: white;
}
.green {
background-color: rgba(0, 128, 0, 0.7);
color: white;
}
.yellow {
background-color: rgba(255, 255, 0, 0.7);
color: blue;
}
.white {
background-color: rgba(255, 255, 255, 0.7);
color: blue;
}
.grey {
background-color: rgba(128, 128, 128, 0.7);
color: white;
}
.score {
text-align: right;
}
.cell {
padding: 6px 8px 0 8px;
/* display: inline-flex; */
/* overflow: auto; */
white-space: nowrap;
font-size: 13px;
min-width: 27px;
/* min-height: 16px; */
display: block;
overflow: auto;
height: 36px;
/* text-overflow: ellipsis */
}
.shadow {
background: linear-gradient(rgba(255, 255, 255, 1), rgba(0, 0, 0, 1), rgba(255, 255, 255, 1));
}
.column {
display: inline-block;
height: 100%;
}
.separator {
display: inline-block;
width: 1px;
}
.timer {
/* width: 60px; */
text-align: center;
}
.container {
border-radius: 10px;
overflow: hidden;
display: table;
clear: both;
font-size: 0;
animation-name: rotation;
animation-duration: 1s;
border: 1px solid grey;
}
#keyframes rotation {
from {
transform: rotateX(90deg);
}
to {
transform: rotateX(0deg);
}
}
.bottom-left {
position: absolute;
bottom: 3vh;
left: 2vh;
}
.bottom-right {
position: absolute;
bottom: 3vh;
right: 2vh;
}
.top-right {
position: absolute;
top: 3vh;
right: 2vh;
}
.top-left {
position: absolute;
top: 3vh;
left: 2vh;
}
.message-title {
text-align: center;
}
.message-body {
text-align: center;
min-width: 150px;
background-color: rgba(0, 0, 0, 0.66);
color: white;
text-transform: none
}
.half-shadow-up {
background: linear-gradient(rgba(255, 255, 255, 1), rgba(128, 128, 128, 1));
}
.tv-logo img {
max-width: 150px;
max-height: 150px;
margin: auto;
}
.foul {
background: linear-gradient(to bottom right, rgb(0, 0, 0), rgb(92, 92, 92));
height: 4px;
margin-top: 0;
margin-bottom: 0;
font-size: 0;
margin-right: 2px;
width: 15px;
display: inline-block;
}
.foul-row {
height: 4px;
}
<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
<div class="container shadow top-right">
<div class="column timer">
<div class="cell red"><span>00:00</span></div>
<div class="cell red">Q4</div>
</div>
<div class="separator"></div>
<div class="column">
<div class="cell white">
<div>Home Team</div>
<div class="foul-row">
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
</div>
</div>
<div class="cell green">
<div>Guest team</div>
<div class="foul-row">
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
<div class="foul"></div>
</div>
</div>
</div>
<div class="separator"></div>
<div class="column score">
<div class="cell white">
100
</div>
<div class="cell green">
65
</div>
</div>
</div>
<div class="container bottom-left">
<div class="column">
<div class="cell white half-shadow-up message-title">
10 A. Player
</div>
<div class="cell message-body">
24 pts, 8 reb
</div>
</div>
</div>
Please try adding your height:4px to foul-row after changing the overflow property on your cell element to hidden:
.cell{
padding: 6px 8px 0 8px;
white-space: nowrap;
font-size: 13px;
min-width: 27px;
display: block;
overflow: hidden; /* changed */
height: 36px;
}