What is the best way to anchor an image so that it remains fixed in its position relative to the browser or screen resolution?

I inquired about an issue a few days back, but I realize now that my explanation was unclear. To make things clearer, let me present two images to illustrate my problem. This is how it appears for me: . However, individuals with different screen resolutions or those who have zoomed in on their browsers see it like this: . I am unsure about how to prevent this from happening.

Below is a snippet of my code. (I'm not very skilled at CSS)

 <style>
    #div1 {
    position: absolute;
        left: 542px;
    top: 432px;
    }
    #div3 {
    position: absolute;
        left: 264px;
    top: 433px;
    }
    #div4 {
    position: absolute;
    left: 1045px;
    top: 432px;
    }
    #div5 {
    position: absolute;
    left: 313px;
    top: 566px;
    }
    #divl {
    position: absolute;
        left: 542px;
    top: 460px;
    }
        </style>

Answer №1

You could try something along these lines:-

<div class="container">
<div class="box size1">Div1 for ranking information</div>
<div class="box size2">Div2 for centralized content</div>
<div class="box size1">Div3 for help section</div>
</div>

css :-

.container
{
 width:100%;
}
.box 
{
 display:inline-block;
}
.size1 
{
 widht:20%;
}
.size2 
{
 widht:60%;
}

Percentage-based widths are recommended

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

Tips for avoiding table column overlap during window resizing situations

My current issue involves using a table to present information. While resizing the window, I noticed that the columns in the table were overlapping. Below is the code snippet: <table style="width:100%;table-layout:fixed"> <tr style="border-bo ...

Bootstrap allows for word wrapping on either one or three lines

I am currently utilizing Bootstrap 3 for my website, and I have a sentence composed of three parts at a certain point on the page. For example, it might read "Bud Spencer walks with Terence Hill." where X="Bud Spencer", Y="walks with", Z="Terence Hill." T ...

Limit a div to only accept a specific stylesheet

Currently, I am immersed in a project that involves HTML5, MVC 4, CSS 3, JQuery, and LINQ. We have meticulously designed styles for various ui, li, and other html controls within the project. However, I now face the challenge of integrating a JQ Grid (htt ...

Alignment of link items within a Bootstrap 4 hamburger menu

Is there a way to display the menu items below instead of to the left? Check out this jsfiddle for more details. Additionally, I am looking to keep the hamburger icon in place and prevent it from moving when clicked. Here is a GIF showing the current beh ...

The Jquery animate function is not compatible with the transform property

I am facing an issue with the Jquery animate function. Despite trying various solutions, I have been unable to get it to work. Below is the HTML code that I have used: <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

Automatic responsive navigation bar in mobile view

As a novice in web programming, I'm facing an issue where the navigation bar shifts to the bottom when the mobile screen size changes. Many solutions online use the hamburger style, which I find less appealing. Here is how the mobile view looks befor ...

Bootstrap 4 Nav Table of Contents with Expand and Collapse Feature

Currently, I am encountering an issue with implementing a button to expand and collapse a "table of contents" in Bootstrap 4. The code I have so far can be viewed here: https://codepen.io/nht910/pen/RwwwyKB Code Snippet: <div class="main-wrapper col- ...

Set the styling of a div element in the Angular template when the application is first initialized

I have a question about this specific div element: <div class="relative rounded overflow-clip border w-full" [style.aspect-ratio]="media.value.ratio"> <img fill priority [ngSrc]="media.value.src || ftaLogo" ...

The grid layout in Bootstrap 4 does not seem to be compatible with dompdf

I am in the process of using dompdf for rendering a PDF file. Our application is built on Bootstrap 4 framework, and I want to incorporate it into the twig template used for generating our documents. However, I have encountered an issue with the Bootstrap ...

Is it possible to modify the variables in a SCSS file within an Angular 2 project?

Currently, I am working with Angular 2 using a SCSS style. My challenge is to retrieve data from a server in order to change a specific variable within the component's style - specifically a percentage value. You can view the SCSS and HTML code here. ...

Implementing a button on a polygon shape within an SVG

I have an SVG at the bottom and I would like to place a button on the bottom line that is also responsive. How can I achieve this using CSS? What I am trying to accomplish: Example Image Is it possible with just CSS and how should I go about implementin ...

positioned division towards a subset

Is there a way to align a div with a span? For instance: <div style="some magic">foo bar<div> <p>this is a random text with <span class="stressed">stressed phrase</span> in it</p> The desired output would look like th ...

Personalize Material design slider Label - final element

When using Material-ui, the default position of Slider's labels is centered: However, I require the labels to have a space-between position. For example: To achieve this, I tried using the '&:last-child' property for the markLabel clas ...

What is the best way to move the Grid upward when the above content is not visible?

Let me demonstrate what I have been working on. Currently, I am creating a weather application to explore the functionalities of https://material-ui.com/. I am attempting to prototype an animation inspired by Google Flights, which can be seen here: https: ...

Tips for modifying the height of a bootstrap-vue table and enabling scrolling with a fixed header

I have a div containing a b-table that I need help adjusting the height for. I want to make the table scrollable with a fixed header. Can anyone assist me? Here is my code: Code inside the template: <div class="tbl-barangay"> <b-table stripe ...

Which component from the Bootstrap library would be best suited for my needs?

I am looking to create a basic 6-page website. Here is the code for my main page: <html> <style> .ali{ width:170px; text-align:center; } footer{ background:#333; color:#eee; font-size:11px; padding-top: 25px; p ...

Texture overlay on a Bulma video background

Is there a way to create an overlay on a background video without covering other components? I want the components to remain visible and on top of everything else, with the background video in the far background, followed by the texture layer, and everyth ...

What causes discrepancies in CSS design across different browsers?

I have implemented the following CSS and HTML code to display an L shape before a span, but its appearance differs across different browsers. In Mozilla Firefox https://i.sstatic.net/1rCoJ.png and In Safari https://i.sstatic.net/YKiJ7.png .bulletInli ...

How can I align a single button to the left side while positioning the rest of the elements to the right in Bootstrap 4?

I am attempting to align the B1 button on the left side and have the remaining elements positioned on the right side. Below is my code snippet using Bootstrap 4.1: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/b ...

The resize() function in jQuery triggers a stack overflow exception

I am trying to manage the resizing of a div on my website, but I am encountering a stackoverflow exception when using the resize function. Can someone please help me understand what I am doing wrong? For reference, here is a jsfiddle example: https://jsfi ...