Search code examples
javascripthtmlcssmobile-website

Mobile Friendly CSS


I have created three different CSS file for a website. When i view the website on a mobile device, it is not displayed correctly. The images and text overlap and the website is not resized. The css code is:

<!DOCTYPE html SYSTEM "about:legacy-compat">
<html xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html;        charset=UTF-8"><title>GET PAID GUARANTEED</title><meta name="description" content="Work from home and    make at least $1000 your first 30 days after completing the training GUARANTEED or get $500 for trying."><meta name="keywords" content=""><meta name="viewport" content="width=device-width, initial-scale=1.0"><link href="http://www.gr-cdn.com/images/squeeze-page/_external/various/favico.png" rel="shortcut icon"><script type="text/javascript" src="http://info_565.gr8.com/images/common/templates/landing/assets/js/lpc.js"></script><link rel="stylesheet" href="http://info_565.gr8.com/images/common/templates/landing/assets/css/reset.css"><link rel="stylesheet" href="http://info_565.gr8.com/images/common/templates/landing/assets/css/core.css"><link rel="stylesheet" href="http://info_565.gr8.com/images/common/templates/landing/assets/css/webform.css"><link rel="stylesheet" href="http://info_565.gr8.com/images/common/templates/landing/108/1/css/style.css"><script type="text/javascript">
                var REG = {
                    thankyouurl: 'http://info_565.gr8.com/thank_you.html',
                    thankyoutext: 'Thank you!'
                }
            </script><style id="def-mark" type="text/css">html, body { background: none; }
@media only screen and (max-width: 480px)
 { 
     div#edi-00kki .text-content { font-size: 4.57vmin !important; }
     div#edi-455k5 .text-content { font-size: 8.8vmin !important; }
     div#edi-1ik15 .text-content { font-size: 8.8vmin !important; }
     div#edi-999kg .text-content { font-size: 4.57vmin !important; }
     div#edi-59959 .text-content { font-size: 4.57vmin !important; }
     div#edi-l19m1 .text-content { font-size: 5.43vmin !important; }
     div#edi-11l11 .text-content { font-size: 4.57vmin !important; }
     div#edi-99212 .text-content { font-size: 4.57vmin !important; }
     div#edi-ri9ri .text-content { font-size: 5.43vmin !important; }
     div#edi-58818 .text-content { font-size: 4.57vmin !important; }
     div#edi-f2731 button div { font-size: 5.87vmin !important; }
     div#edi-g2gg2 button div { font-size: 5.87vmin !important; }
     div#edi-47ji4 .text-content { font-size: 4.57vmin !important; }
   }
     .gridline.vertical { height: 100%; min-height: 1367px; }
     div#edi-58818 .text-content { line-height: 1.4; font-size: 32px; }
     div#edi-l19m1 .text-content { line-height: 0.8; text-shadow: rgba(0, 0, 0, 0.4) 0px 5px 5px;        }
     div#edi-11l11 .text-content { text-shadow: rgba(255, 255, 255, 0.611765) 0px -1px 2px; line-          height: 1.2; }
     div#edi-g2gg2.buttonhover { border: 0px none rgb(0, 0, 0); box-shadow: rgb(204, 69, 28) 0px  9px 0px 0px; border-top-left-radius: 11px; border-top-right-radius: 11px; border-bottom-left-radius:  11px; border-bottom-right-radius: 11px; background-color: rgb(229, 77, 31); }
     div#edi-g2gg2.buttonhover button div { color: rgb(255, 255, 255); font-weight: normal; font- style: normal; text-decoration: none; }
     div#edi-g2gg2 { border: 0px none rgb(0, 0, 0); box-shadow: rgb(204, 69, 28) 0px 9px 0px 0px;  }
    div#edi-47ji4 .text-content { text-shadow: rgb(0, 0, 0) 0px 1px 2px; }</style><style id="def- mark-hover" type="text/css"></style></head><body><body xmlns="http://www.w3.org/1999/xhtml"  marginwidth="0" marginheight="0" data-twttr-rendered="true" id="body-99lll" data-uid="body-99lll">
   <div hidden="true" id="OPT">
      <form action="#" method="post">
   <div>
      <select name="GoogleWebFont">
      <option value="'Oswald', cursive">
       Oswald:300,400,700:latin,latin-ext
      </option>
      <option value="'Roboto', serif">
        Roboto:300,500,700:latin,latin-ext
      </option>
    </select> <input type="hidden" name="template_id" value="108|1" />
   </div>
  </form>
   </div>
   <section data-section="section" style="height: 1366px; background-image:   url(https://multimedia.getresponse.com/301/5361301/photos/34770001.jpg); background-attachment:   initial; background-color: rgba(0, 0, 0, 0); background-size: cover; background-position: 50% 50%;  background-repeat: no-repeat;" id="section-m51mj" data-uid="section-m51mj" data-bggradient="linear- gradient(to bottom, rgba(0, 0, 0, 0), rgba(251, 233, 172, 1))" class="">
  <div data-section="wrap" data-reverse="true">
  <div data-editable="box" style="top: 377px; left: 297px; width: 402px; height: 34px;   background-color: rgba(255, 255, 255, 0.8);" data-reverse="true" id="edi-8didk" data-uid="edi-8didk"  class=""></div>
  <div data-editable="box" style="top: 411px; left: 172px; width: 657px; height: 36px; background-color: rgba(255, 255, 255, 0.8);" data-reverse="true" id="edi-19889" data-uid="edi-19889" class=""></div>
  <div data-editable="box" style="top: 447px; left: 296px; width: 400px; height: 39px; min-height: 43px; background-color: rgba(255, 255, 255, 0.8);" data-reverse="true" id="edi-17ki1" data-uid="edi-17ki1" class=""></div>
  <div data-editable="text" style="top: 452px; left: 161px; width: 666px; height: 32px;" id="edi-59959" data-uid="edi-59959" class="">
    <div style="color:#0158c6; font-weight:700; font-size:26px;font-family:'Roboto', Helvetica, Arial, sans-serif; text-align:center;" class="text-content">
      Then you are PRE-APPROVED!
    </div>
  </div>
  <div data-editable="text" style="top: 375px; left: 129px; width: 742px; height: 83px;" id="edi-999kg" data-uid="edi-999kg" class="">
    <div style="color:#282828;text-align:center; font-weight:500; font-size:26px;font-family:'Roboto', Helvetica, Arial, sans-serif; line-height:140%;" class="text-content">
      Are you at least 18 years old?<br />
      Do you have access to a reliable internet connection?<br />
    </div>
  </div>
  <div data-editable="box" style="top: 635px; left: 145px; width: 731px; height: 661px; min- height: 390px; background-image: linear-gradient(rgb(244, 200, 49), rgb(251, 233, 172)); background-attachment: scroll; background-color: rgb(255, 255, 255); background-origin: padding-box; background-clip: border-box; background-position: 0% 0%; background-repeat: repeat;" data-reverse="true" id="edi-544a5" data-uid="edi-544a5" data-bggradient="linear-gradient(rgb(244, 200, 49), rgb(251, 233, 172))" class="">
    <div data-editable="box" style="top: -90px; left: -3px; width: 739px; height: 157px; background: url(https://app.getresponse.com/images/common/templates/landing/108/1/img/03.png) 50% 0% no-repeat;" data-reverse="true" id="edi-5m2i5" data-uid="edi-5m2i5" class=""></div>
    <div data-editable="text" style="top: 60px; left: 0px; width: 718px; height: 74px;" id="edi-11l11" data-uid="edi-11l11" class="">
      <div style="color:#fff; font-size:24px; font-family:'Roboto', Helvetica, Arial, sans-serif; text-align:center;" class="text-content">
        <span style="color: rgb(0, 0, 0);"><span style="font-family: Oswald, Helvetica, Arial, sans-serif; font-size: 26px;">Completely fill in the form below,</span></span>
        <div>
          <span style="font-family: Oswald, Helvetica, Arial, sans-serif; font-size: 26px; color: rgb(0, 0, 0);">You will receive an e-mail containing a link to the next step...</span>
        </div>
      </div>
    </div>
    <div data-editable="text" style="top: -70px; left: -16px; width: 756px; height: 134px;" id="edi-l19m1" data-uid="edi-l19m1" class="">
      <div style="color: rgb(255, 255, 255); font-weight: 700; font-size: 50px; font-family: Oswald, Helvetica, Arial, sans-serif; text-align: center;" class="text-content">
        <font size="6" style="font-size: 35px;">Make at least $1,000 within 30 days of completing</font>
        <div>
          <font size="5" style="font-size: 35px;">our step by step training or get paid $500 for trying!</font>
        </div>
      </div>
    </div>
    <div data-editable="webform" style="height: 571px; width: 307px; top: 144px; left: 206px;" id="edi-66eei" data-uid="edi-66eei" class="">
      <form action="" accept-charset="utf-8" method="post" style="width: 307px; height: 571px;">
        <div class="wf-wrap">
          <div class="wf-item type-placeholder" style="top:0;" data-type="text">
            <div class="wf-item-pos" style="left: 0px; max-width: 307px;">
              <div class="label" style="width: 307px;">
                <label style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; line-height: 60px; color: rgb(0, 0, 0); padding: 18px; font-weight: normal; font-style: normal; text-shadow: none;" for="wb-input-61rmm">Your Name</label>
              </div>
              <div style="width: 307px; height: 60px;">
                <input type="text" name="name" style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; color: rgb(0, 0, 0); border: 3px solid rgb(236, 240, 242); padding: 0px 8px; font-weight: normal; font-style: normal; background: rgb(255, 255, 255);" autocomplete="off" id="wb-input-61rmm" />
              </div>
            </div>
          </div>
          <div class="wf-item type-placeholder" style="top:84px;" data-type="text">
            <div class="wf-item-pos" style="left: 0px; max-width: 307px;">
              <div class="label" style="width: 307px;">
                <label style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; line-height: 60px; color: rgb(0, 0, 0); padding: 18px; font-weight: normal; font-style: normal; text-shadow: none;" for="wb-input-nnn61">Your Email</label>
              </div>
              <div style="width: 307px; height: 60px;">
                <input type="text" name="email" style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; color: rgb(0, 0, 0); border: 3px solid rgb(236, 240, 242); padding: 0px 8px; font-weight: normal; font-style: normal; background: rgb(255, 255, 255);" autocomplete="off" id="wb-input-nnn61" />
              </div>
            </div>
          </div>
          <div class="wf-item type-placeholder" style="top: 168px;" data-type="text">
            <div class="wf-item-pos" style="left: 0px; max-width: 307px;">
              <div class="label" style="width: 307px;">
                <label style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; line-height: 60px; color: rgb(0, 0, 0); padding: 18px; font-weight: normal; font-style: normal; text-shadow: none;" for="wb-input-1xx1x">Phone Number</label>
              </div>
              <div style="width: 307px; height: 60px;">
                <input type="text" name="custom_PhoneNumber" value="" style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; color: rgb(0, 0, 0); border: 3px solid rgb(236, 240, 242); padding: 0px 8px; font-weight: normal; font-style: normal; background: rgb(255, 255, 255);" autocomplete="off" id="wb-input-1xx1x" />
              </div>
            </div>
          </div>
          <div class="wf-item" style="top: 224px;" data-type="radio">
            <div class="wf-item-pos" style="left: 3px; max-width: 307px;">
              <div class="label" style="width: 307px;">
                <label style="font-family: Helvetica, Arial, sans-serif; font-size: 21px; line-height: 60px; color: rgb(0, 0, 0); padding: 0px 0px 6px; font-weight: normal; font-style: normal; text-shadow: none;" for="Howmanyhourscanyouworkfromhomeea-0"># of hours you can work weekly:</label>
              </div>
              <div style="width: 307px; height: 60px;">
                <label for="Howmanyhourscanyouworkfromhomeea-0" style="white-space: nowrap; width: 13px;"><input type="radio" id="Howmanyhourscanyouworkfromhomeea-0" name="custom_Howmanyhourscanyouworkfromhomeea" value="1-5" autocomplete="off" style="font-size: 20px; padding: 0px 21px;" /> 1-5</label> <label for="Howmanyhourscanyouworkfromhomeea-1" style="white-space:nowrap;"><input type="radio" id="Howmanyhourscanyouworkfromhomeea-1" name="custom_Howmanyhourscanyouworkfromhomeea" value="11-20" /> 11-20</label> <label for="Howmanyhourscanyouworkfromhomeea-2" style="white-space:nowrap;"><input type="radio" id="Howmanyhourscanyouworkfromhomeea-2" name="custom_Howmanyhourscanyouworkfromhomeea" value="21-30" /> 21-30</label> <label for="Howmanyhourscanyouworkfromhomeea-3" style="white-space:nowrap;"><input type="radio" id="Howmanyhourscanyouworkfromhomeea-3" name="custom_Howmanyhourscanyouworkfromhomeea" value="6-10" /> 6-10</label>
              </div>
            </div>
          </div>
          <div class="wf-item type-placeholder" style="top: 398px;" data-type="text">
            <div class="wf-item-pos" style="left: 1px; max-width: 307px;">
              <div class="label" style="width: 307px;">
                <label style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; line-height: 60px; color: rgb(0, 0, 0); padding: 18px; font-weight: normal; font-style: normal; text-shadow: none;" for="wb-input-s11b6">Date You Are Available To Start</label>
              </div>
              <div style="width: 307px; height: 60px;">
                <input type="text" name="custom_data_DateYouAreAvailableToStart" value="" style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; color: rgb(0, 0, 0); border: 3px solid rgb(236, 240, 242); padding: 0px 8px; font-weight: normal; font-style: normal; background: rgb(255, 255, 255);" autocomplete="off" id="wb-input-s11b6" />
              </div>
            </div>
          </div>
          <div class="wf-item" style="top: 478px;" data-type="submit">
            <div class="wf-item-pos" style="left: 5px; max-width: 210px;">
              <div style="width: 298px; height: 68px;">
                <button type="submit" value="Sign up now!" id="wb-button-ero16" style="font-size: 36px; padding: 0px 13px; border: 5px none rgb(255, 255, 255); box-shadow: rgb(20, 0, 130) 0px 5px 1px 2px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background-image: none; background-color: rgba(43, 55, 237, 0.901961);">
                <div>
                  Send Me More Info!
                </div></button>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
  <div data-editable="box" style="top: 198px; left: 172px; width: 663px; height: 154px; background: url(https://app.getresponse.com/images/common/templates/landing/108/1/img/08.png) 50% 0% no-repeat;" data-reverse="true" id="edi-65641" data-uid="edi-65641" class=""></div>
  <div data-editable="box" style="top: 69px; left: 127px; width: 672px; height: 168px; min-height: 277px; background: url(https://app.getresponse.com/images/common/templates/landing/108/1/img/02.png) 50% 0% / 635px no-repeat scroll padding-box border-box rgba(0, 0, 0, 0);" data-reverse="true" id="edi-4kb95" data-uid="edi-4kb95" data-bggradient="linear-gradient(to bottom, rgba(26, 110, 18, 1), rgba(0, 0, 0, 1))" class="">
    <div data-editable="text" style="top: 151px; left: 50px; width: 649px; height: 114px;" id="edi-1ik15" data-uid="edi-1ik15" class="">
      <div style="color:#fff; font-size:81px;font-family:'Oswald',Helvetica, Arial, sans-serif; line-height:110%; text-align:center;text-shadow: rgba(0,0,0,.4) 0 5px 5px;" class="text-content">
        <font size="6" style="font-size: 70px;"><font>FOR GUARANTEED PAY</font> !</font>
      </div>
    </div>
    <div data-editable="text" style="top: 26px; left: 21px; width: 624px; height: 110px;" id="edi-455k5" data-uid="edi-455k5" class="">
      <div style="color:#fff;text-align:center; font-size:81px;font-family:'Oswald',Helvetica, Arial, sans-serif; line-height:120%;text-align:center;text-shadow: rgba(0,0,0,.4) 0 5px 5px;" class="text-content">
        WORK FROM HOME
      </div>
    </div>
  </div>
  <div data-editable="text" style="width: 727px; height: 21px; top: 1337px; left: 151px;" id="edi-47ji4" data-uid="edi-47ji4" class="">
    <div style="text-align: center; font-size: 18px; font-family: Helvetica, sans-serif; color: rgb(0, 0, 0);" class="text-content">
      <span style="color: rgb(255, 255, 255);">We hate SPAM too! We would never share your personal information.</span>
    </div>
  </div>
</div>


Solution

  • Using % to set widths and heights is the approach you are looking for since the % is relative to the viewport size and adapts its size depending on it. When you set a width/height as a fixed number of pixels, say 500px, it will be 500px in any viewport, causing the overflows you mention and messed up layouts.

    Here you have got two examples:

    Your first approach (absolute measures):

    Absolute sizes

    and relative measures:

    Relative sizes

    In each, you can minimize your browser window and resize it at will. You will see that with the absolute size approach, the divs maintain their size, even if the screen is smaller than them. On the relative size approach, you can see the divs adapting to the resize action.

    Now, rebuild your website this way and you will fix your problems