Creating an HTML layout that consists of three image elements placed over a single background image with each image

In my HTML code, I am utilizing multiple div elements. Each div is designated to hold an image with dimensions of 1600*750. Within each div, there is a fixed image that repeats across all the divs by using a specified class. Here are the details for each fixed image: - The first image measures 218*73 - The second image measures 774*209 - The third image measures 127*37

My goal is to set the position of these fixed images within the background div image as follows: - Position the first image at 137*88 - Position the second image at 655*339 - Position the third image at 708*670

It is important for me not to use the body element to fix the background image since I have multiple divs each containing three fixed images.

I am seeking assistance on how to achieve this positioning using CSS classes for multiple divs. Thank you in advance!

Below is the structure of my HTML and CSS:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My page</title> 
<title>jQuery Parallax Plugin Demo</title>
 <link rel="stylesheet" type="text/css" href="sd.css" />

</head>

    <body>
 <div id="a"> 
    <div id="first" >
       <div class="c d" >

       This is my first div to display image.





   </div>-->


 </body>
</html>

CSS

 body{
    margin: 0;
    min-width: 980px;
    padding: 0;
    padding: 0;
 }

div {
    -webkit-perspective: 500px; /* Chrome, Safari, Opera */
    perspective: 500px;
}


#first{
    width: 100%;
 }


#first{

    background:url('images/rc1.jpg') 50% 0 no-repeat fixed;
    color: white;
    height: 600px;
    margin: 0 auto;
    padding: 160px 0 0 0;
    padding: 0;
     perspective: 1px;

}
#first .d{
    margin: auto;
    position: relative;

    width:=655px;
    height:339px;
    background: url('images/Logo.png');
    background-repeat: no-repeat;
    background-attachment: fixed;

}
#first .c{
    margin: auto;
    position: relative;

    width:=137px;
    height:88px;
    background: url('images/big_text.png');
    background-repeat: no-repeat;
    background-attachment: fixed;

}
 #first .e{
    margin: auto;
    position: relative;
    overflow-x: 708px;
     overflow-y: 670px;

    background: url('images/big_text.png');
    background-repeat: no-repeat;
    background-attachment: fixed;

}

Answer №1

Here is a sample code showcasing the sizes and positions of your images:

body {
    background-image:url('http://placehold.it/1600x750');
}
.first {
    background-image:url('http://placehold.it/218x73');
    border:1px dashed #000;
    display:block;
    height:73px;
    left:137px;
    position:absolute;
    top:88px;
    width:218px;
}
.second {
    background-image:url('http://placehold.it/774x209');
    border:1px dashed #000;
    display:block;
    height:209px;
    left:655px;
    position:absolute;
    top:339px;
    width:774px;
}
.third {
    background-image:url('http://placehold.it/127x37');
    border:1px dashed #000;
    display:block;
    height:37px;
    left:708px;
    position:absolute;
    top:670px;
    width:127px;
}
<div class="first"></div>
<div class="second"></div>
<div class="third"></div>

Answer №2

Is it possible for you to generate a code snippet where the div tags are not properly closed, with the first and c div elements nested within the div "a"?

<div id="a">
    <div id="first">
        <div class="c d">

            This is my initial div for showing an image.
            
        </div>
    </div>

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

Arrangement of asymmetrical interactive forms

I am in need of creating a design featuring numerous non-rectangular shapes that are interactive and reveal an image when clicked. The concept is to transform an image of stained glass into a webpage where each pane can be clicked to unveil its colorful ve ...

Converting HTML into an image in a Node.js Buffer

Can you suggest a simple method to convert a raw HTML string, like the following: <b>Hello World</b> into a regular PNG image in Node.js Buffer form? I've been exploring various npm packages for a solution that supports this functionali ...

Is the click count feature malfunctioning?

My goal is to track every mouse click made by the user, so I created a function for this purpose. However, it seems that the function is only counting the first click. To store the count values, I have created a variable. <!DOCTYPE html PUBLIC "-//W3 ...

When I try to hover my mouse over the element for the first time, the style.cursor of 'hand' is not functioning as expected

Just delving into the world of programming, I recently attempted to change the cursor style to hand during the onmouseover event. Oddly enough, upon the initial page load, the border style changed as intended but the cursor style remained unaffected. It wa ...

Error encountered when attempting to reinitialize DataTable while iterating through multiple tables and searching within tabs

Currently, I am utilizing DataTable to display 3 separate tables with the help of tabs, along with a search function. However, every time I load the page, I encounter a reinitialization error. Here is the snippet of my code: _datatables.forEa ...

Adjustable / consistent box height

For hours, I've been attempting to make some divs the same height. Check out my JSfiddle here: https://jsfiddle.net/4cj5LbLs/15/ I experimented with using display: table; in the parent element and either display: table-cell; or display: table-colum ...

When utilizing React, I generated an HTML page with a distinct .js file, however, encountered two unexpected errors

Update : Gratitude to everyone who has helped me in tackling this issue. One user suggested using a web server, but my intention was to find a solution using just a single HTML and JS file. Even though I tried following the steps from a similar question o ...

Tips for showing a variety of headers on your page

I am struggling to align multiple headers on the same horizontal line. Despite my efforts, only two of them display correctly while the third keeps dropping down a line. To see what I mean, take a look at this image: view current layout Here is the code ...

When a base html tag is dynamically added, the browser mistakenly loads assets twice

When managing relative paths on a website, I utilize the <base> tag within the <head> section of each page. Although all resources loaded via relative-like paths in the documents are displayed correctly, my observations show that browsers such ...

The script remains static and does not alter the "href" or "div" content based on the current URL

I am having an issue with my NavMenu on my website. It is a table with images that link to product pages, and I want to change the links and names based on the language of the site. However, the script I wrote for this is not working properly. I have tried ...

Looking to make changes to the updateActivePagerLink setting in JQuery Cycle?

I'm in the process of developing a basic slideshow with 3 images, and I am relatively new to Jquery and Cycle. The slideshow is functioning properly, and the 3 pager links are also functional. The only remaining task for me is to implement "activeSli ...

The styled components can create identical CSS classes with varying conditions

Below are the CSS styles I am currently using: import styled, { css } from "styled-components"; const H4 = css` font-family: "Futura"; font-style: normal; font-weight: 500; font-size: 20px; line-height: 140%; color: #3a786a ...

Converting RSS title to HTML format with the help of JavaScript

I am currently working on populating a menu on a webpage with the 5 latest topics from our site's RSS newsfeed using JavaScript (specifically jQuery version 1.9.1). I have been searching for a solution, but most answers I find reference deprecated scr ...

What is the best way to responsively center an after pseudo-element above its parent?

Looking to create a dynamic tooltip without any fixed widths or constraints on the parent element. The process seems simple enough, but I'm facing an issue with centering the after element due to an existing transform attribute of transform: translat ...

Navigation Menu in Motion

I'm currently working on a website for my F1 in Schools team and I'm looking to implement a feature where the button in the navigation bar changes its background color and font color when that section of the page is active, even while scrolling o ...

Translate CSS into JavaScript while maintaining selector understanding

I am interested in developing a tool that can read a .css file and generate a function that will accept an array of class names as input and output the corresponding styles for an element with those classes, represented as a JavaScript object. This tool wo ...

Curious about the distinction between express-ejs-layouts and DHTML?

According to Google search results, DHTML involves generating HTML content dynamically using Javascript. Meanwhile, EJS also claims to do the same thing with its abbreviation of Embedded JavaScript. It seems like both DHTML and EJS have similar functional ...

Strategies for detecting when a child checkbox is clicked within a parent li element

Below is a snippet of Vue Code illustrating the structure we're working with: <template> <li class="mm-product-item" v-on:click="edit(item)"> <p class="mm-product-info input-field"> <input ...

Error triggered by using double border property

I'm currently working on a simple form template and its corresponding style sheet, but I've encountered an issue. When using the "double" border property to style forms, it seems to push the border beyond the containing element, which is affectin ...

Node.js suffering from 'empty post method' issue

I am encountering an issue while retrieving values from certain fields in an index HTML. The post method is returning empty values, with { } being returned instead of the expected email, nick, name, and pass values. Here is my server.js code: var mongoos ...