Can't resize gap, widht and height on sass with media query - sass

I'm resizing a card with media query but the labels I've created inside it gets weird because of the gap from the parent div. I know I can fix it changing the gap of the parent div and the widht and height of the labels, but I'm not beeing able to do that.
It stays like this
I want it to be like this
I'm using SASS and bootstrap 5.3.0.
This is a challenge from Frontend Mentor btw.
HTML:
<div class="card" id="submitCard">
<div class="star"><img src="images/icon-star.svg" alt=""></div>
<p class="cardTitle">How did we do?</p>
<p class="cardDescription">Please let us know how we did with your support request. All feedback is appreciated to help us improve our offering!</p>
<form id="ratingForm">
<div class="inputs">
<input type="radio" name="rating" id="rating1" value="1"></input>
<label for="rating1">1</label>
<input type="radio" name="rating" id="rating2" value="2"></input>
<label for="rating2">2</label>
<input type="radio" name="rating" id="rating3" value="3"></input>
<label for="rating3">3</label>
<input type="radio" name="rating" id="rating4" value="4"></input>
<label for="rating4">4</label>
<input type="radio" name="rating" id="rating5" value="5"></input>
<label for="rating5">5</label>
</div>
<button class="submitBtn">Submit</button>
</form>
</div>
CSS:
#submitCard{
#ratingForm{
color: var(--text-color);
margin-top: 10px;
.inputs{
display: flex;
justify-content: space-between;
gap: 20px;
label{
display: grid;
place-content: center;
background-color: var(--btn-color);
border-radius: 50px;
width: 50px;
height: 50px;
padding-top: 5px;
}
input[type="radio"]{
display: none;
&:checked + label {
background-color: var(--btn-selected-color);
color: var(--white);
}
&:hover + label{
background-color: var(--primary);
color: var(--white);
cursor: pointer;
}
}
}
}
}
Media query:
#media (max-width: 430px){
.card{
width: 360px;
padding: 25px;
border-radius: 15px;
}
#submitCard {
#ratingForm{
.inputs {
gap: 0;
label{
width: 45px;
height: 45px;
}
}
}
}
}

Well.. The thing is: I placed my media query before the styles I was trying to change. I guess i'm going back to practice. 😂🤡
I found the answer by this post: Css id's don't change on media queries

Related

Why the <label> size is different on Firefox?

In all other browsers, these cards (.resort__cards) are correctly spaced. Because the <label> is the same size as the <img> (even though the <img> tag is the child element and the <label> is the parent element.)
But in Firefox the <label> does not obey this size, so the cards overlap.
This happens because the <label> tag is the size of the ORIGINAL <img> (188 x 319px), that is, the <label> tag does not have the size of the <img> tag that I modified (which would be height: 100%).
Does anyone know why this happens?
>Print Chrome<
>Print Firefox<
PS: Sorry for my bad english!
.resorts__cards {
display: flex;
width: 100vw;
height: 55vh;
margin: 50px 0 50px auto;
z-index: 0;
overflow-y: hidden;
overflow-x: scroll;
box-sizing: content-box;
scrollbar-width: none;
-ms-overflow-style: none;
scroll-snap-type: x mandatory;
}
.resorts__cards img {
width: auto;
height: 100%;
margin: 0 20px;
border-radius: 20px;
scroll-snap-align: center;
}
.resorts__1 {
position: relative;
overflow-y: hidden;
height: 100vh;
}
.resorts__2 {
overflow-y: hidden;
position: relative;
height: 100vh;
}
.resorts__3 {
position: relative;
overflow-y: hidden;
height: 100vh;
}
<div class="resorts__cards">
<label for="resorts1">
<img src="https://chi01pap002files.storage.live.com/y4m_b-iLV2IGtXJsxH846loaz8VdbEzeC5JRXnhkr3DESFs2lbjsh9SE5N890gLy7ts1tagl0szlHhkTPzSC4kljYlz5MsnZyKvX8_NksSEP_bhdqqtW_j_yp6Z4-4KkJ41f6Hm0R6HcdWdOgis4172b3RsscYULK7t-zF64yd70gZoU6fBhieAJqxY82FOfz21?width=188&height=319&cropmode=none" alt="video lux"/>
</label>
<label for="resorts2">
<img src="https://chi01pap002files.storage.live.com/y4mFUVIFs2d7rBVSQng4PvGOuEAjfc9ddKfnEkN-Jt6imdinCeRhmFpgkGZwpDnpDhMW_RsfoZXNhJrxFPe5sk3Y-JB50HxXIYT-i6JT4HddJ8LoNhbNEcobtoBbyZOzhT7lLjrhovkCKnVGAWmI9VjrzGQw9RqcGY1xUTF-9fVU2-rYD3WZCCJ-aBECzLZFOsY?width=188&height=319&cropmode=none" alt="Six Senses"/>
</label>
<label for="resorts3">
<img src="https://chi01pap002files.storage.live.com/y4m4nMmzNd1FnSHpMzcIh_ysk5xUOtQvQ0W9acJ-pmrEfmnPSS8rgz71W252EJffuDnWoo46-BVz-RYovckctPV1Evh7SUz3Wu-vP5c62yxEN7Q0FtyiC2odZbVSJojUmTK_AMEEBCIdQWO0-6LJZwfNWzep8Hgu_dSYBF9wa2KezWz4UpMwJ0K7tBUbVW2t0KW?width=188&height=319&cropmode=none" alt="Ayada"/>
</label>
</div>

Change size on hover of one flex element with overlapping another

Change size on hover of one flex element with overlapping another.
Like this
You can use CSS transform property like this
selector {
... /* others styles */
transition: 0.4s;
}
selector:hover {
transform: scaleY(1.2)
}
refer https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale()
<div class="flex justify-content-evenly align-items-start flex-wrap">
<div class="relative container w-full w-3 h-22rem">
<div class="item-container grid inline absolute top-0 left-0">
<div class="text-center col">
<img class="w-full" src="assets/images/buket2.png" alt="buket">
</div>
<div class="col">
<h5 class="m-0">Bouquet 117 (21 gerberas)</h5>
<p class="text-400 text-sm font-medium mt-1">Fresh flowers</p>
<p class="font-bold">€83.49 EUR</p>
</div>
<button label="Add to cart" icon="pi pi-shopping-cart">
</button >
</div>
</div>
.item-container {
border: 1px solid #E7E7E7;
box-sizing: border-box;
border-radius: 10px;
margin: 15px 0 15px 0;
padding: 20px 20px 0 20px;
background-color: white;
&:hover {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
z-index: 2;
.buy-btn {
display: block !important;
}
}
}

How do I adjust a container/boostrap grid to occupy whole screen?

I'm trying to use bootstrap grid to format my webpage layout. There are two elements on my page, an image and a subtitle for the image. I would like that both elements occupy the whole screen of a smartphone, just under the navbar. Could anyone help me? I'm also tryint to make it looks nice on pc and other plataforms.
I have done some progress using media screen, but its still clunky.
Thats my .index html:
<div class="row">
<div class="combocontainer col-lg-12">
<div class="combocontainer">
<div class="top-container">
<img class="avatar" src="Images/minimalist.jpg" alt="avatar" />
</div>
<div class="signature">
<h1>My Name</h1>
</div>
</div>
</div>
</div>
Thats my css:
.avatar {
display: block;
margin-top: 220px;
margin-left: auto;
margin-right: auto;
height: 100%;
width: 100%;
}
.combocontainer{
height: 100vh;
}
#media screen and (min-width: 1000px) {
.combocontainer {
display: block;
margin-top: 6rem;
margin-left: auto;
margin-right: auto;
height: 20%;
width: 20%;
}
}
/* No implementation yet */
.signature {
text-align: center;
height: 20%;
width: 20%;
font-family: "romatehood-p73ed-webfont";
}

twitter bootstrap columns not clearing

I have a three column layout where the logo at browser view is to the left, one word is in the middle, and the nav menu is to the right. This is fine at full browser.
When it is resized to mid or mobile view the columns are not clearing and stacking correctly.
Here is what I am getting right now at full view: http://postimg.org/image/wvfl1hkut/
Here is what needs fixed at mobile and mid view: http://postimg.org/image/sa1nvyw8j/
Here is my code:
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="header">
<div class="col-xs-6 col-sm-4">
<a href="{{ URL::route('home') }}">
<div class="header_group">
<img src="../../images/logo.png">
</div><!--header group -->
</a>
</div>
<div class="col-xs-6 col-sm-3"></div>
<div class="col-xs-6 col-sm-4">
<p> </p>
</div>
<div class="col-xs-6 col-sm-4">
#include('layout.navigation')
</div>
</div><!-- main header -->
</div><!-- row -->
</div>
</div>
External CSS sheet
.header {
width: 100%;
height: auto;
margin: 0 auto;
background: red;
}
.header_group {
background-color: none;
width: 100%;
height: auto;
display: inline-table;
font-size: 1.5em;
font-weight: 400;
font-family: 'Roboto', sans-serif;
color: #f0fff0;
clear: none;
margin-top: 5%;
}
.header_text {
vertical-align: middle;
display: inline;
text-align: center;
color: #f05152;
}
.nav {
width: auto;
height: auto;
margin-top: 12%;
}
.nav a {
color: #000;
padding-left: 10%;
margin-left: 4%;
}
.navbar {
width: 100%;
height: 20%;
padding-top: 0;
}
.wrapper {
width: 100%;
height: 500px;
background: url(../../../images/yellow.png) repeat,
}
Bootstrap has a 12 column grid. Each set of 12 columns should be contained in a .row.
Your code has 4 .col-xs-6 columns, which total 24 columns. It also has 3 .col-sm-4 and 1 .col-sm-3 columns, which total 15 columns.
If you place the columns in their correct rows of 12 then they will clearfix correctly.
FYI: From the documentation...
Content should be placed within columns, and only columns may be immediate children of rows.
Move .header.

jQueryMobile - Phonegap - transitions blinking with calling $.ajax [duplicate]

I have an awkward visual glitch. I want a nice transition when changing pages on an app.
Unfortunately, the first time I change to another page, instead of sliding the current page out and the new page in, the current page is immediately replaced by the new page and then slides out. When the first page is out of view, the new page is shown. However, the second time around, it works like a charm!
This is running on iphone with jQuery Mobile + PhoneGap
I made a video to help clarify the issue: http://www.youtube.com/watch?v=Ybvzh_wTnSE
<body style="background-color: #000;">
<div id="container" style="display:none;">
<div id="side-menu" style="display:none;">
<div id="header_top"></div>
<div id="header_dives" class="selected"></div>
<div id="header_spacer1"></div>
<div id="header_explore"></div>
<div id="header_spacer2"></div>
<div id="header_search"></div>
<div id="header_spacer3"></div>
<div id="header_settings"></div>
<div id="header_bottom"></div>
</div>
<div id="slide_mask">
<!-- START of LOGIN page -->
<div data-role="page" id="login">
<div id="home_frame">
<div id="home_logo"></div>
<div id="home_fblogin" onclick="login()"></div>
<div class="home_login">
<p>Email: <input type="text" name="user[email]" size="30"/></p>
<p>Password: <input type="password" name="user[password]" size="30"/></p>
<button onclick="show_page_home();">LOGIN</button>
</div>
</div>
</div>
<!-- END of LOGIN page -->
<!-- START of LOGIN page -->
<div data-role="page" id="dives" class="right_pane">
<p>My dives !</p>
</div><!-- /content -->
<div data-role="page" id="explore" class="hidden right_pane">
<p>My explore !</p>
</div><!-- /content -->
<div data-role="page" id="search" class="hidden right_pane">
<p>My search !</p>
</div><!-- /content -->
<div data-role="page" id="settings" class="hidden right_pane">
<p>My settings !</p>
<button onclick="logout_db();">logout</button>
</div><!-- /content -->
<!-- END of LOGIN page -->
</div>
</div>
<div id="log"></div>
<div id="data"></div>
</body>
And the relevant CSS:
body {margin: 0; font: 18px Helvetica; text-align: center; background-color: #000; background: url(../img/bg_big.png) repeat;
-webkit-user-select: none; /* prevent copy paste for all elements */
}
#container { width:320px; height:460px; overflow: hidden;}
input{ -webkit-user-select: text; /* enable copy paste for elements with this class */}
a {-webkit-user-select: none; /* prevent copy paste for all elements */}
span {-webkit-user-select: none; /* prevent copy paste for all elements */}
#side-menu {z-index: 1000 !important; position: fixed; height: 460px; width: 56.5px; background: url(../img/bg_big.png) no-repeat; display: inline-block;
overflow: hidden; top: 0px; left: 0px; }
#header_top {background: url(../img/header/header_top.png) no-repeat; background-size: 56.5px 48.96px; width: 56.5px; height: 48.96px; display: block;}
#header_dives {background: url(../img/header/dives.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;}
#header_dives.selected{background: url(../img/header/dives_selected.png) no-repeat;}
#header_spacer1{background: url(../img/header/header_space1.png) no-repeat; background-size: 56.5px 13.9px; width: 56.5px; height: 13.9px; display: block;}
#header_explore{background: url(../img/header/explore.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;}
#header_explore.selected{background: url(../img/header/explore_selected.png) no-repeat;}
#header_spacer2{background: url(../img/header/header_space2.png) no-repeat; background-size: 56.5px 15.33px; width: 56.5px; height: 15.33px; display: block;}
#header_search{background: url(../img/header/search.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;}
#header_search.selected{background: url(../img/header/search_selected.png) no-repeat;}
#header_spacer3{background: url(../img/header/header_space3.png) no-repeat; background-size: 56.5px 17.73px; width: 56.5px; height: 17.73px; display: block;}
#header_settings{background: url(../img/header/settings.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;}
#header_settings.selected{background: url(../img/header/settings_selected.png) no-repeat;}
#header_bottom{background: url(../img/header/header_bottom.png) no-repeat; background-size: 56.5px 160px; width: 56.5px; height: 160px; display: block;}
.hidden {display: none;}
.right_pane{width: 263.5px !important; background: url(../img/right_bg.png) no-repeat; background-size:263.5px 460px; width: 263.5px; height: 460px; left: 56.5px !important;}
#slide_mask{ display: inline-block; overflow: hidden; padding-left: 56.5px; width: 263.5px; height: 460px; top: 0;}
and the bit of JS:
///////////////////////////////////
//MENU MECHANICS
///////////////////////////////////
function showdives(){
$("#side-menu .selected").removeClass("selected");
$("#header_dives").addClass("selected");
}
function showexplore(){
$("#side-menu .selected").removeClass("selected");
$("#header_explore").addClass("selected");
}
function showsearch(){
$("#side-menu .selected").removeClass("selected");
$("#header_search").addClass("selected");
}
function showsettings(){
$("#side-menu .selected").removeClass("selected");
$("#header_settings").addClass("selected");
}
The onclick methods only add/remove the "selected" class to/from the menu items.
I believe people refer to this as "flickering", so you'll have better results when you search for that. After looking around, it looks like your problem is common on android and can be solved by adding the following CSS:
.ui-page {
-webkit-backface-visibility: hidden;
}
Here are a few references:
http://blogs.bytecode.com.au/glen/2011/07/14/eliminating-annoying-flicker-transitions-with.html
Flickering when navigating between pages
https://forum.jquery.com/topic/performance-of-jquery-mobile-on-android-2-2-and-2-3-flickering
I and my friends are using JQuery 1.2.
The way to solve this issue was to put data-transition="none". Maybe this cannot appear mobile
style that much, but works and delete the flickering problem.
Hope this help.
I had the same problem, but even worse, when wrapping a Jquery mobile app in Phonegap. Not only were the page transitions flickering, but the UI was completely broken. I used Jquery 1.8 and Jquery mobile 1.2 in this app.
I have tried most of the solutions suggested here on SO, but nothing worked. Then I found this solution by Piotr Walczyszyn, and everything worked like a dream! Highly recommended for anyone using Jquery mobile and Phonegap together.

Resources