How can I improve my webpage code to be scalable for smaller sizes?

ppgking

I'm having trouble figuring out how to make my webpage on codepen scalable. It look fine on a larger screen, but if you scale the browser smaller or view it on mobile everything gets whacky. I tried using position: relative; to make the outer div elements stay the same size as it's contents, but when you make the window smaller they end up being pushed out. I also tried img-responsive class for my images, but it did not seem to help.

I'm fairly new to javascript, html, and css and would really appreciate any tips on how I could improve the styling.

Here is the code on codepen.

Angel Politis

You can use @media queries in CSS to make your website scalable and responsive. The are a lot of ways to use media queries, but I like to use them like so:

.element {
    /* The code to be used for this element in general */
}

@media screen and (min-width: 1300px) {
    .element {
        /* The code to be used for this element in devices wider than 1300px */
    }
}

The above example can show different content at different sizes based on the minimum width of the screen of the user's device. There so many options that, literally, the sky is the limit!

Some very common mobile device dimensions you will most likely need to use at some point are:

  • 320px x 640px (Average dimensions of a mobile device)
  • 360px x 640px (Samsung Galaxy S5)
  • 411px x 731px (Google Nexus 5X)
  • 414px x 736px (iPhone 6 Plus)
  • 768px x 1024px (iPad)

Some other useful properties are:

  • Max-width (Base your choices upon the maximum width of a device's screen)
  • Orientation (It can be either landscape or portrait and it means the side you hold your phone)
  • Aspect-ratio (The ratio between the width and the height of the viewport)
  • Device-aspect-ratio (The ratio between the width and the height of the device), etc.

Be sure to check out these pages for info related to the correct use of media queries as well as easily comprehensible examples:

Another way to enhance your webpage's scalability and responsiveness is to use powerful frameworks like Bootstrap, which are designed to aid you in making your webpage more responsive in far less time than you would do on your own.

You can find a very helpful tutorial for Bootstrap here.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I improve my code to reduce the synthesis time?

From Dev

How can I improve my SQL code for correct results?

From Dev

How can I improve my code to reduce the synthesis time?

From Dev

How can I improve my SQL code for correct results?

From Dev

How can i improve my python code regarding while loops

From Dev

How can I improve my code to handle large numbers?

From Dev

How can I improve my "if and else if" VBA? code

From Dev

IE displays my code instead of my webpage, how can I fix this?

From Dev

How can I improve the performance of my script?

From Dev

How can I improve my linux security?

From Dev

How can I improve my android layout

From Dev

I want to display the occurrence of a character in string. How can I improve my code?

From Dev

How can I improve and shorten this block of code?

From Dev

How can I improve the performance of this code?

From Dev

How can I improve this code in python?

From Dev

How can I improve this GPA calculation code?

From Dev

How can I improve this JavaScript code?

From Dev

How can I stucture my django code for a webpage with suppose 4 different divisions of data

From Dev

How can I improve my code design to remove the need for 'instanceof' in Java?

From Dev

How can I improve my code design to remove the need for 'instanceof' in Java?

From Dev

How can I connect my container group (scalable container) to my mongodb container (single node) on Bluemix?

From Dev

How can I create my own GUID algorithm with smaller "global"?

From Dev

How can I make my form responsive on all sizes

From Dev

How do I post a sample of PHP code on my webpage?

From Dev

How do i improve my existing code for GetOpenfile function

From Dev

How do I improve my Python code about heap sort?

From Dev

How can I embed the new GIFV format on my webpage?

From Dev

How can I hide a div when my webpage is viewed in Lynx?

From Dev

How can I remove a some javascript from my webpage?

Related Related

  1. 1

    How can I improve my code to reduce the synthesis time?

  2. 2

    How can I improve my SQL code for correct results?

  3. 3

    How can I improve my code to reduce the synthesis time?

  4. 4

    How can I improve my SQL code for correct results?

  5. 5

    How can i improve my python code regarding while loops

  6. 6

    How can I improve my code to handle large numbers?

  7. 7

    How can I improve my "if and else if" VBA? code

  8. 8

    IE displays my code instead of my webpage, how can I fix this?

  9. 9

    How can I improve the performance of my script?

  10. 10

    How can I improve my linux security?

  11. 11

    How can I improve my android layout

  12. 12

    I want to display the occurrence of a character in string. How can I improve my code?

  13. 13

    How can I improve and shorten this block of code?

  14. 14

    How can I improve the performance of this code?

  15. 15

    How can I improve this code in python?

  16. 16

    How can I improve this GPA calculation code?

  17. 17

    How can I improve this JavaScript code?

  18. 18

    How can I stucture my django code for a webpage with suppose 4 different divisions of data

  19. 19

    How can I improve my code design to remove the need for 'instanceof' in Java?

  20. 20

    How can I improve my code design to remove the need for 'instanceof' in Java?

  21. 21

    How can I connect my container group (scalable container) to my mongodb container (single node) on Bluemix?

  22. 22

    How can I create my own GUID algorithm with smaller "global"?

  23. 23

    How can I make my form responsive on all sizes

  24. 24

    How do I post a sample of PHP code on my webpage?

  25. 25

    How do i improve my existing code for GetOpenfile function

  26. 26

    How do I improve my Python code about heap sort?

  27. 27

    How can I embed the new GIFV format on my webpage?

  28. 28

    How can I hide a div when my webpage is viewed in Lynx?

  29. 29

    How can I remove a some javascript from my webpage?

HotTag

Archive