Exploring Website Layouts Across Various Screen Resolutions

I am facing an issue with my website layout. While it looks great on a 20" screen, on an 11" screen the elements are not displaying correctly. The #logo is overlapping the #menu, and the #bubble is appearing below the #frame. I had set percentage size parameters based on a tutorial I found, which worked for some elements but not all. What could be causing this problem?

I suspect that the height and width of the #bubble might be the issue since they are still in ems. When attempting to switch to percentages, I lost the circular shape and the #bubble often moved to the bottom of the page.

HTML:

<body>
    <div id="top">
        <div>
            <p id="logo">XXXXXXXXXXX</p>

            <div id="menu">
                <h3 id="test">xxxxxx</h3>
                <h3 id="test2">xxxxxx</h3>
                <h3 id="test3">xxxxxx</h3>
                <h3 id="test4">xxxxx</h3>
                <h3 id="test5">xxxxxx</h3>
            </div>
        </div>
    </div>

    <div id="frame">
            <div id="main"></div>
    </div>
</body>

CSS

body {
    width: 100%;
    margin-top: 0%;
    margin-left: 0%;
    margin-right: 0%;
    background-image: url("http://www.wallpapersmood.com/uploads/2010-07/july-high-defintion-wallpaper/1280109101-FWEMRDA.jpg");
}

#top {
    background-color: black;
    width: 100%;
    height: 50px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
}

#logo {
    text-align: center;
    position: absolute;
    margin-top: 0.5%;
    margin-left: 2%;
    color: white;
    font-family: Impact,cursive;
    font-size: 160%;
}

h3 {
    width: 10%;
    height: 10%;
    border-radius:  9px;
    text-align:  center;
    line-height: 2;
    display: table-cell;
    font-size: 120%;
    font-family: "Verdana";
    color: white;
}

h3:hover {
    background-image: -webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.35, rgb(60,156,196)),
        color-stop(0.68, rgb(90,188,236)),
        color-stop(0.84, rgb(117,226,255)));
    opacity: 1;
}

#menu {
    float: left;
    width: auto;
    height: auto;
    margin-left: 20%;
    margin-top: 0.5%;
}

#frame {
    width: 78%;
    height: 90%;
    border: 1px solid;
    border-radius: 20px;
    margin-left: auto ;
    margin-right: 5%;
    margin-top: 1%;
    background-color: white;
    opacity: 0.9;
    float: right;
}

#main {
    height: 90%;
    width: 80%;
    border: 1px solid black;
    border-radius:15px;
    float: right;
    margin-right: 2%;
    margin-top: 2%;
    margin-bottom: 2%;
    background-color: white;
    overflow: auto;
}

#main img {
    max-width: 60%;
    max-height: auto;
    margin: auto;
    margin-top: 2%;
    display: block;
    border-radius: 15px;
}
#bubble {
    position: absolute;
    height: 14em;
    width: 14em;
    border: 6px dashed white;
    text-align: center;
    border-radius: 100%;
    margin-left: 1%;
    margin-top: 1%;
    opacity: 0.6
}

#bubble p {
    position: relative; 
    top: 20%;
    font-size: 200%;
    color: white;
    font-family: "Impact";
}

Answer №1

Utilizing CSS @media queries allows for the customization of styles based on different screen sizes. Explore more about this concept here.

Essentially, it operates similar to conditional "if" statements.. For instance, "if the window size exceeds 500px," apply a specific set of CSS rules.. or "if the window size is between 300px and 500px," implement another set of rules, and so on.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to Align Item at Center in Bootstrap 5 Jumbotron

My jumbotron contains the bx-message-error icon that I want to center both horizontally and vertically in a row. Despite searching online and going through the documentation, I haven't been able to align it. I'm sure it's a simple fix, so an ...

Is it possible to incorporate a Node.js library into an HTML document?

I am working on an HTML file where I want to incorporate the nodemailer library to handle email sending. Although in nodejs, I can easily include var nodemailer = require('nodemailer') at the beginning of the script section of my HTML file, it ap ...

Troubleshooting the issue with the simple Angular material layout/flex example

I attempted to implement a basic layout/flex example from the Angular material design demo site: https://material.angularjs.org/latest/layout/container However, no matter what I try, the layout does not function as described and simply arranges the four ...

Problems arise when using AngularJS' .run function after navigating to a different page

I have encountered an issue with ngRoute while navigating between pages in my web application. The main login page is called index.html, and the routing is controlled by the main js file. However, I face a problem when trying to use a .run block on a speci ...

Utilizing Angular 2+ with the [innerHTML] property to incorporate HTML with added style attributes

I am currently utilizing Angular 2+ [innerHTML] input for inserting HTML formatting that includes style tags. Within my template, the code looks like this: <span [innerHTML]="someVar"></span> In the component file, I have defined: someVar = ...

Show large emoji as the background image of a jumbotron

Check out this incredible jumbatron I want to spruce it up by adding three random emojis on the right side like in this example I created using paint: how it should look Any suggestions on how I can achieve that? Here's a snippet of my CSS: .ju ...

Is it possible to apply a CSS Transition to just one specific type of transform?

Can you animate just one type of css transform using transitions? My css looks like this: cell{ transform: scale(2) translate(100px, 200px); transition: All 0.25s; } Now I only want to animate the scale property. I could use position:absolute with ...

Is there a way to determine if jQuery Mobile has already been loaded?

I am dynamically loading jqm and I'm trying to determine if it has been previously loaded in certain scenarios. Is there a method to check for the presence of jqm? ...

What is the best way to position <div> elements?

I'm having trouble aligning two elements to create columns and adding a footer. Currently, the elements are stacked horizontally and the footer is inline with them. How can I adjust the formatting of the page? h1 { color: #225522; margin: 0px ...

The navigation bar remains fixed while the section heading fails to display properly

================================= My webpage acts like a homepage on the web. The issue arises when clicking on a new link, as my navbar is fixed and covers the section heading. I need the page to display the section heading properly even after clicking o ...

Json Swagger Editor: Error - Undefined

There is an undefined error in rendering when using the Swagger Editor. Here is the code snippet: swagger: '2.0' info: version: 1.0.0 title: AccountBalance host: localhost:2625 basePath: /accountbalance schemes: - http - https consumes: ...

Firefox Flaw: Animation Issues with CSS

My Website has a CSS animation that creates a hover effect on a button. While the animation looks good in Chrome and IE, I encountered an issue with Firefox. https://i.sstatic.net/y2po7.png Some white pieces are still visible after hovering. Here is th ...

Tips for placing a checkbox above a DIV element when generating checkboxes within a foreach loop

This is the output I have generated This HTML code belongs to me <td class="category" colspan ="2" id="tdcategory1"> <div id="category1" style="border:none !important; overflow:hidden; width:auto; height:auto"> </div& ...

Utilize Boostrap to stylishly incorporate an image within a DIV using CSS

I have a project with numerous HTML pages all containing the same elements. To make updating easier, I decided to call all images from the CSS files so that if an image needs to be changed, I only need to update the CSS file rather than each individual HTM ...

Issue with overlapping positioning of child components in React

I've come across multiple inquiries addressing this issue, yet none of them have provided a solution that fits my problem. In my scenario, there's a Parent component containing three Child components. import React, { Component } from 'react ...

Unable to modify SVG color to a white hue

I am currently working on an Angular project where I am utilizing SVG to display some icons. These icons originally have a default grey color, but I want them to change to white when hovered over. Interestingly, while changing the color to red, green, or y ...

The website is not displaying CSS styles as intended

I'm currently in the process of building a website with Bootstrap 5, but I've encountered an issue where the properties from index.css are not taking effect on index.html. Specifically, when I hover over a service card, the background is supposed ...

The compatibility of IE9 with tables and the use of display: block

When optimizing my site for low-width mobile devices, I adjust the display property of various table elements such as tr, td, and th to block in order to stack them vertically. This technique helps wide tables to show all their content without overflowing ...

Leveraging the Bootstrap 3 audio player, although displaying a standard HTML5 output

When trying to use the Bootstrap 3 player to display an audio player, I'm encountering an issue where the page only shows a default black HTML5 audio player output. Here is my current directory structure: miuse/ application/ bootstrap/ ...

How to Align Navigation Bar Items to the Right in Bootstrap 4

I need some help with bootstrap. I've looked at various discussions on this topic and tried numerous solutions, but I still can't get it right. I want the logo to be on the left and the navigation links aligned to the right. Here's what I&ap ...