Solved

Content of html page scatter when resized with browser

Posted on 2013-06-21
8
986 Views
Last Modified: 2013-06-23
I have the css and html below. Everything looks good if the page is in a normal view but once I begin to resize my browser, the content begins to scatter meaning I might not be able to view the page in a hand held device.
How can I correct this?




* Html
-------------------------------------------------------------*/

html {
    background-color:#D8D8D8;
    margin: 0;
    padding: 0;
}


  * {
        padding: 0px;
        margin: 0px
    }


/* Page level
--------------------------------------------------------------*/
 #page-level
    {
        max-width:960px;
        margin:0 auto;
        padding-bottom:0;
       
    }

/* Header
--------------------------------------------------------------*/
    #ameHeader
    {
      background-image:url('../images/Ame_Revised_Header.png');
      max-width: 960px;
      height: 100px;
    }


/* Body
--------------------------------------------------------------*/    
    #mybody
    {
        background-color:white;
        margin:0;
        padding:0;
        min-height: 700px;
        font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
        font-size: .85em;
    }
   
   
 /* Footer
--------------------------------------------------------------*/  
    #ameFooter
    {
        background-image:url('../images/Ame_Footer.png');
        max-width: 960px;
        height:40px;
        border-top:5px solid red;  
    }
   
    #ameFooter p
    {
        color: White;
        text-align : center;
        padding-top: 6px;  
    }
   
   
 /* Others
--------------------------------------------------------------*/  
    .username
    {
        float:right;
        color:White;
        padding-right: 4px;
    }
   
    #ameHeader p
    {
        color: White;
       
    }
   
    .title
    {
       float:left;
       color:White;
       padding-top: 40px;
       font-weight:bold;
       font-size:x-large;
       padding-left: 4px;  
    }
   
    .uploadSection
    {
        padding-left: 20px;
        padding-top: 25px;  
    }
 
    h2
    {
        padding-left: 20px;
        padding-top: 10px;
    }

    button
    {  
        color: #FFF;  
        background-color: black;  
        font-weight: bold;
        max-width:90px;
        height:35px;
        border: 3px solid #900;
    }
   
   td
   {
       font-family: Arial;
       font-size: 12pt;
       font-weight:bold;
       }
       
   .spaceSecondDiv
   {
        padding-top: 140px;
        padding-left:80px;      
   }

******************************


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Services</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    <body>
        <div id="page-level">
            <div id="ameHeader">
                <p class="title">ONLINE  PROCESS</Title></p>
                <p class="username">@User.Identity.Name</p>                            
            </div>
            <div id="mybody">
                @RenderBody()
            </div>
            <div id="ameFooter">
              <p> © Crazy Services, Inc. 2013. </p>
            </div>
       
        </div>
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)

    </body>
</html>
0
Comment
Question by:Sirdots
8 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Things like "@User.Identity.Name" mean nothing here because that's not what is seen by the browser.  You need to post a link or the HTML from the "View Source" so we can see what the browser sees.  For all we know, you could be putting 1000 characters in there for "@User.Identity.Name".
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
Yeah if you want real answers you need to give us a real link.  My preliminary asesment is that you are getting what you asked for because you are using inflexible values in pixels.  You may need to use media queries, and you position/dimensioning values may need to be converted to percentage em, or possibly viewport relative values.

Cd&
0
 

Author Comment

by:Sirdots
Comment Utility
Thanks. Unfortunately I dont have this page online but here is my view source

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>AmeriPride Services</title>
        <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        <link href="/Content/site.css" rel="stylesheet"/>

        <script src="/Scripts/modernizr-2.5.3.js"></script>

    </head>
    <body>
        <div id="page-level">
            <div id="ameHeader">
                <p class="title">ONLINE SCRIPTING PROCESS</Title></p>
                <p class="username">CORP\F44ld</p>                            
            </div>
            <div id="mybody">
               

<h2>File upload section</h2>


    <form method="post" action="">
    <div class="uploadSection">
        <table>
            <tr>
            <td>Select script</td>
            <td>            
                <select name = "mydropdown">
                    <option value="12.1">12_1_flat_goods_bm_2_to_1</option>
                    <option value="12.2">12_2_mats_bm_1_2_to_3</option>
                    <option value="13">13_deliverybilling</option>
                    <option value="15">15_customersurvey</option>
                    <option value="16">16_costprice</option>
                    <option value="17">17_product_description</option>
                    <option value="18">18_emblem_template</option>
                    <option value="20">20_add_sample_product</option>
                    <option value="21">21_wearerinv_cleanup</option>
                    <option value="22">22_statementlayout</option>
                    <option value="23">23_customer_style_conversion_garments</option>
                    <option value="24">24_customer_special_charge</option>
                    <option value="25">25_customer_style_conversion_nongarments</option>
                    <option value="26">26_customer_size_conv_garments</option>                  
                </select>          
            </td>
            <td>Path to source file: </td>
            <td><input type="text" name="path" size="35"  /></td>
            <td><button type="submit" value="Submit">Upload File</button></td>
            <td><button type="submit" value="Submit">Submit</button></td>          
            </tr>            
        </table>
    </div>
    <div class="spaceSecondDiv">
            <table>
            <tr>
                <td>
                    <textarea cols="60" rows="15" ></textarea>
                </td>
            </tr>
            </table>
    </div>
    </form>








            </div>
            <div id="ameFooter">
              <p> © Pride Inc. 2013. </p>
            </div>
       
        </div>
        <script src="/Scripts/jquery-1.7.1.js"></script>

       

    </body>
</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
The following require attention:

Using a table to layout a form makes it extremely lacking in responsive capabilities.

The very long strings in the options of the select force the select and the cell containing to be wide and rigid.

I don't see anything you are doing to actually control the layout under variable conditions.
"<meta name="viewport" content="width=device-width" /> guarantees nothing but trouble if you do not have media queries to apply styling for different devices.

Cd&
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:Sirdots
Comment Utility
Thanks coboldinosaur. so what do you suggest I do? what is media queries? so what are your suggestiongs? Remove the table right?
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
If you don't want to show your url, it helps to put it to jsbin or jsfiddle.  Please see this version I made for you http://jsbin.com/iyidow/1/edit by clicking html and css tabs at the top, you can view just the rendered html.  I don't see anything scattering but I do see when you narrow the browser it stays off the page.  As suggested you will need to use media queries.  

There is nothing wrong with tables if used for tabular data.  In this case, they will get in your way with what you want to do.  I would suggest getting rid of the tables and use Div's instead.  

Here I have recoded using div's instead of your table.  http://jsbin.com/iyidow/2/edit  Not pretty for now, but you can see it is on the path to what you want.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
0
 

Author Closing Comment

by:Sirdots
Comment Utility
Thanks a lot for this. Very helpful
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now