How can I make this form responsive for mobile? - html

I am trying my popup form responsive but unsuccessfully.
Any help will be appreciated!
That's the landing page URL - yogavoga.com/2weekdiet
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
max-width: 100%;
height: 100%;
overflow: auto;
background-color: rga(0,0,0);
background-color: rgba(0,0,0,0.85);
padding-top: 65px;
}
.modal-content {
margin: 5px auto;
width: 95%;
background-color: #fefefe;
border: 1px solid #888;border-width:3px;
}
I'd like to make it responsive for mobile as well.
Tried but couldn't get the right result.

You have to use media queries to make your website responsive.
here is the list of media queries for different device sizes:
/* Extra small devices (phones, 600px and down) */
#media only screen and (max-width: 600px) {...}
/* Small devices (portrait tablets and large phones, 600px and up) */
#media only screen and (min-width: 600px) {...}
/* Medium devices (landscape tablets, 768px and up) */
#media only screen and (min-width: 768px) {...}
/* Large devices (laptops/desktops, 992px and up) */
#media only screen and (min-width: 992px) {...}
/* Extra large devices (large laptops and desktops, 1200px and up) */
#media only screen and (min-width: 1200px) {...}
Now you have to write device-specific css in one of the above media queries.
like :
#media only screen and (min-width: 600px) {
.modal {
//add Mobile specific css for responsive design.
}
}

Related

Make text responsive according to how tall the tab is

How would I go about having my text be bigger, so my text goes to the bottom of the tab (without a scrollbar showing up or anthing) and when the tab gets smaller, make the font smaller.
h1 {
font-size: ?;
}
div {
length: according to browser;
}
You can use height: 100vh; to set height according to screen height, and for font-size you can use #media queries to set font size for different screen.
body {
margin: 0px;
padding: 0px;
}
div.box {
height: 100vh;
background-color: #666;
}
h1 {
font-size: 50px;
color: #ffffff;
margin: 0px;
padding: 30px;
}
/* Extra small devices (phones, 600px and down) */
#media only screen and (max-width: 600px) {
h1 {
font-size: 25px;
}
}
/* Small devices (portrait tablets and large phones, 600px and up) */
#media only screen and (min-width: 600px) {
h1 {
font-size: 35px;
}
}
/* Medium devices (landscape tablets, 768px and up) */
#media only screen and (min-width: 768px) {
h1 {
font-size: 45px;
}
}
/* Large devices (laptops/desktops, 992px and up) */
#media only screen and (min-width: 992px) {
h1 {
font-size: 55px;
}
}
/* Extra large devices (large laptops and desktops, 1200px and up) */
#media only screen and (min-width: 1200px) {
h1 {
font-size: 65px;
}
}
<div class="box">
<h1>Karar Barcha</h1>
</div>
You can use vw for font-size if you want to be changed size by resizing of browser:
However, using vw for elements such as text means you may want to use media-queries for mobile devices to avoid very small text, such as the <p> element.
h1 {
font-size: 4vw;
}
<body>
<h1>arman ebrahimi</h1>
</body>

How to make the logo fit in both PC and Mobile browsers?

I have a twitter bootstrap 3 application and the SVG logo looks great in Desktops but looks truncated in the mobile browsers e.g. iOS Safari.
My very standard code looks like this:
<!-- RD Navbar Brand-->
<div class="rd-navbar-brand brand">
<a class="brand-name" href="/"><img src="images/logo.svg" height="100"></img></a>
</div>
Is there a way, for example, to reduce the logo size in case of mobile device detected?
you can use media queries like this:
/* Large desktops and laptops */
#media (min-width: 1200px) {
.my-logo {
width:300px;
}
}
/* Landscape tablets and medium desktops */
#media (min-width: 992px) and (max-width: 1199px) {
.my-logo {
width:250px;
}
}
/* Portrait tablets and small desktops */
#media (min-width: 768px) and (max-width: 991px) {
.my-logo {
width:200px;
}
}
/* Landscape phones and portrait tablets */
#media (max-width: 767px) {
.my-logo {
width:150px;
}
}
/* Portrait phones and smaller */
#media (max-width: 480px) {
.my-logo {
width:100px;
}
}

Media Query overriding other media query only on Safari/iOS devices

I have this issue where my media queries are messing up on my iPhone and iPad, my tablet media query is targeted on my iPhone so the layout on mobile is all wrong.
I have already checked my ordering of the media queries, and they are from smallest to biggest since as I styled the page starting from mobile view first.
.career-feature-icon {
width: 100%;
height: 300px;
padding: 10px;
#media screen and (min-width: 37.5rem) {
float: left;
width: 50%;
}
#media (min-width: 64rem) {
width: 25%;
}
img {
width: 200px;
height: 200px;
display: block;
margin: 0 auto;
}
h2 {
text-align: center;
#media (min-width: 64rem) {
padding-top: 20px;
}
}
}
My styling is there, but it is overruled by whatever is in the 37.5rem media query.
Again this is ONLY on iOS devices, any help is greatly appreciated!
SOLVED: I changed my media query from REM to px 37.5rem -> 600px 64rem -> 1024px and it rendered the way it should
/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px (48rem to 64rem)
*/
#media (min-width: 768px) and (max-width: 1024px) {
//CSS
}
/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/
#media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
//CSS
}
/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px (30.065rem to 47.93rem)
*/
#media (min-width: 481px) and (max-width: 767px) {
//CSS
}
/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 480px (20rem to 30rem)
*/
#media (min-width: 320px) and (max-width: 480px) {
//CSS
}
Try this might work

CSS - Render 10% of the image below the viewport for all screen sizes

I have a mobile layout for the website I am building, where the image of a mobile screen has to always appear a till it's navigation buttons. Below is the design mockup of how the image should look
I am using media queries, the width of the image and margin-top to position it according to the mockup. But at certain viewports, the image appears completely above the screen, which is mostly due to the different viewports resulting in different values for the percentage based units I am using.
An example image of what I am trying to convey:
Is there a better approach to position this image, so that it always shows up to its navigation bar, so that the position is consistent atleast in a particular viewport range, if not every viewport?
Any help is appreciated.
the website for reference : https://hackertronix.com
.mobile-phone-img {
display: block;
margin: 3% auto 0;
width: 70%;
}
#media screen and (min-width:24em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 85%;
}
}
#media screen and (min-width:25.75em) {
.mobile-phone-img {
margin: 11.5% auto 0;
width: 66%;
}
}
#media screen and (min-width:30em) {
.mobile-phone-img {
margin: 11.5% auto 0;
width: 60%;
}
}
#media screen and (min-width:37.5em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 65%;
}
}
#media screen and (min-width:42em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 55%;
}
}
#media screen and (min-width:48em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 50%;
}
}
#media screen and (min-width:50em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 45%;
}
}
#media screen and (min-width:55em) {
.mobile-phone-img {
margin: 2.5% auto 0;
width: 40%;
}
}
<div class="mobile-card">
<h2>
Tracker
</h2>
<a target="_blank" href="https://play.google.com/store/apps/details?id=tracker.gst.in.gsttracker">
<img src="images/getOnGooglePlay.png" class="mobile-button">
</a>
<img src="images/gst-tracker-pixel.png" class="mobile-phone-img">
</div>
Well known media query resolution for almost every devices.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
#media (min-width: 1281px) {
//CSS
}
/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
*/
#media (min-width: 1025px) and (max-width: 1280px) {
//CSS
}
/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px
*/
#media (min-width: 768px) and (max-width: 1024px) {
//CSS
}
/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/
#media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
//CSS
}
/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px
*/
#media (min-width: 481px) and (max-width: 767px) {
//CSS
}
/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 479px
*/
#media (min-width: 320px) and (max-width: 480px) {
//CSS
}

responsive design - css favouring biggest resolution media query

I recently started learning responsive design for mobiles etc and i am using troy.labs.daum.net to test on, it started out working fine on my first two media queries although when I choose from the resolution list now it only shows the 400px width query
heres my css
#media only screen and max-width 320px {
#searcher
{
width:190px;
height:30px;
float:left;
}
#searcherin
{
width:185px;
height:16px;
margin-top:6px;
border:1px solid #ccc;
padding-left:4px;
text-transform:capitalize;
}
}
#media only screen and max-width 360px {
#searcher
{
width:230px;
height:30px;
float:left;
}
#searcherin
{
width:225px;
height:16px;
margin-top:6px;
border:1px solid #ccc;
padding-left:4px;
text-transform:capitalize;
}
}
#media only screen and max-width 400px {
#searcher
{
width:268px;
height:30px;
float:left;
}
#searcherin
{
width:264px;
height:16px;
margin-top:6px;
border:1px solid #ccc;
padding-left:4px;
text-transform:capitalize;
}
}
Am I doing something wrong with this?
The links is http://2click4.com/new/mobile/home.php
Reverse the order start with the biggest and have the smallest at the end. For smaller size, you only need to define the rules that changed between the current size and the previous as the 360 will carry the rules from 400 and above.
#media only screen and (max-width: 400px) { ... }
#media only screen and (max-width: 360px) { ... }
#media only screen and (max-width: 320px) { ... }
http://jsfiddle.net/88wgM/
Resize the viewing area and see the change, if you reverse it like in your code, it does not work
Make sure you have
(max-width: 400px)
the () and : after max-width
When you starting develop responsive design its very important you specify the orientation!
/*Tablet devices*/
#media only screen and (min-width: 0px) and (max-width: 320px) and (orientation: landscape) {
...
}
/*Tablet devices*/
#media only screen and (min-width: 321px) and (max-width: 360px) and (orientation: landscape) {
...
}
/*Tablet devices*/
#media only screen and (min-width: 361px) and (max-width: 400px) and (orientation: landscape) {
...
}
First off all you need to specify the lowest width devices. Then you move to biggest ones!
Here is a good boilerplate you can use to start your media queries in your stylesheet.
// Small screens
#media only screen { } /* Define mobile styles */
#media only screen and (max-width: 40em) { } /* max-width 640px, mobile-only styles, use when QAing mobile issues */
// Medium screens
#media only screen and (min-width: 40.063em) { } /* min-width 641px, medium screens */
#media only screen and (min-width: 40.063em) and (max-width: 64em) { } /* min-width 641px and max-width 1024px, use when QAing tablet-only issues */
// Large screens
#media only screen and (min-width: 64.063em) { } /* min-width 1025px, large screens */
#media only screen and (min-width: 64.063em) and (max-width: 90em) { } /* min-width 1025px and max-width 1440px, use when QAing large screen-only issues */
// XLarge screens
#media only screen and (min-width: 90.063em) { } /* min-width 1441px, xlarge screens */
#media only screen and (min-width: 90.063em) and (max-width: 120em) { } /* min-width 1441px and max-width 1920px, use when QAing xlarge screen-only issues */
// XXLarge screens
#media only screen and (min-width: 120.063em) { } /* min-width 1921px, xlarge screens */