Require guidance and resolution

<div class="container">
  <div class="top-section">
   <img id="image1" />
   <img id="image2" />
  </div>
  <div class="content">
   ...
  </div>
  <div class="bottom-section">
   ...
  </div>
</div>

<style type="text/css">
.container {
    margin-left: auto;
margin-right: auto;
margin-top: -8px;
width: 1024px;
height: 1500px;
background-color: #CCC;
border: 1px solid;
/*display: run-in;*/
/*position:fixed;*/
text-align: center;
}

.top-section {
background-color: #FFC;
/*margin: 0 auto;*/
height: 150px;
width: 1000px;
display: flex;
z-index: 10;
text-align:center;
vertical-align:middle;
position: fixed;
display:block;
}

#image1 {
position: relative;
width: 100%;
}

#image2{
position: relative;
z-index: 10;

}

I am looking to create a fixed width container with a top section that has two images centered both vertically and horizontally inside. The header should stay at the top of the page and contain the images overlapping each other.

To clarify, the container's width is fixed, the top section should be fixed at the top of the page (inside the container) with two images that overlap and are centered within the header both horizontally and vertically. I hope this explanation is clear now.

Answer №1

How about this: [briefly some untested pseudo code]

CSS:

.container{
 width: 960px;
 margin-left: auto;
 margin-right: auto;
}

.section{
/*add styles here*/
}

.header{
 position: absolute;
 top: 0px;
 width: 100%;
 min-height: 150px;
 margin-top: 40%; /*adjust based on content*/
}

HTML structure:

<div class="header section">
       <img />
       <img />
   </div>
    <div class="container">

      <div class="content">
       ...
      </div>
      <div class="footer">
       ...
      </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

Exploring the functionality of CodePen's code editor in relation to developing a 2D shooting game

Recently, I created a straightforward 2D shooter game with all the code neatly organized in a single HTML file: (file_gist). When I tested the game in my chrome browser, everything worked flawlessly according to my intentions. However, upon transferring th ...

Utilizing Jquery for Mouse Clicks

Is there a way to simulate a mouse click using jQuery? <div id="myId> Simulate Mouse Click programatically</div> I currently have a mouse listener set up. $("#myId").mousedown(function(){ alert("Mouse clicked programatically"); }) ...

JavaScript News Scroller for Horizontal Display

After searching through numerous websites, I have yet to find the ideal horizontal news scroller for my website. My specific requirements include: Must provide a smooth scrolling experience Scroll from right to left covering 100% width of the browser ...

Want to learn how to create an image magnifier using just one image?

At first, I created an image magnifier that would zoom in when the user hovered over the image. However, now I am looking to switch to a lens zooming method that uses only one image. ...

Transforming the format from YYYYMMDD using MomentJS

Currently, I have a date in the format of YY as shown here: 20141229. I am attempting to convert it into Timestamp format. I attempted using moment(date).format('x'), but received an "Invalid date" error. I'm unsure of how to accomplish this ...

Modify the content of an iframe within a specific element

$(document).ready(function () { $('#keywordframe').contents().find("#step12").html(''); $('#keywordframe').contents().find("#step12").html('11'); $('#keywordframe').contents().find("#step13").ht ...

What is the process of retrieving DropDownList items upon submission?

In my project, I have the following information: MODEL public class AnimalModels { public string AnimalId { get; set; } public List<SelectListItem> AnimalList { get; set; } } VIEW @model DropDownList.Models.AnimalModels @{ View ...

Ways to access a JavaScript function on a div with multiple identifiers

Currently working on developing a discussion panel using ASP.net, where each comment is assigned a unique id. I am looking to trigger the jQuery click function whenever a user clicks on a comment. However, since the comment ids are dynamically assigned an ...

Ways to incorporate file upload feature into the WooCommerce payment process

Adding a file upload field on the WooCommerce checkout page is not supported natively due to security reasons. I am in need of a way to incorporate a file upload field so that customers can provide a document to be attached to their order for future refere ...

Issue with retrieving body class in Internet Explorer on Magento platform. The body class is not being recognized in IE, but works fine in Mozilla and Chrome

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>" dir="ltr"> <?php echo $this->getChildHtml('head') ?> <bod ...

When hosted, OpenCart encounters a JavaScript error stating that the property "document" cannot be read because it is null

After successfully running opencart on my local machine, I encountered some errors upon uploading it to the hosting/server. The specific error message is as follows: Uncaught TypeError: Cannot read property 'document' of null f.each.contents @ j ...

Send a POST form from my website to another website and retrieve the data from the remote server

My website, example.com, includes a web HTML form that leads to another site where the results are currently displayed. I want to retrieve these results from the other website using PHP or some other method and showcase them on my own site. However, the fo ...

Issue with Attaching Click Event to Dynamic Div Elements

I've implemented divs with a Click Event triggered by a value entered in a text box. See an Example Here Upon opening the page, clicking any rows will trigger an alert. However, if you change the value in the text box (Enter Number) and click load, ...

Emphasize specific letters in a word by making them bold, according to the user

In my app, there is a search feature that filters data based on user input and displays a list of matching results. I am trying to make the text that was searched by the user appear bold in the filtered data. For example, if the user searches 'Jo&apos ...

What are some effective ways to manage errors in Ajax deferred calls?

What is the best way to handle an Ajax deferred error? function CallingApi() { return $.ajax({ url: 'http://localhost:10948/Api/Home/GetEmployee123', contentType: 'application/x-www-form-urlencoded', ...

Incorporate a platform-specific button in a user interface with React Native

I need to display a button that is only shown on iOS, not on android. I have tried using the following style, but it doesn't seem to be working. ...Platform.select({ android: { display:'none', }, The code for my button is: <Bu ...

What is the best way to empty textfields following an ajax query in jquery?

Here's the jQuery function I'm using to perform an AJAX query: $("#add").click(function() { val1 = $('#add_lang_level').val(); val = $('#add_lang').val(); listitem_html = '<li>'; listitem_html ...

Utilize Javascript to conceal images

On a regular basis, I utilize these flashcards. Recently, I have started using images as answers. However, I am facing an issue - I am unable to conceal the pictures. My preference is for the images to be hidden when the webpage loads. function myShowTe ...

Is there a way to position a table to the left using bootstrap?

I've been struggling to align my table to the left side of my page using bootstrap with Flask. Despite numerous attempts, the tables remain centered and unaffected on the page as shown below. {% extends "base.html" %} {% block title %}Home{% ...

Listening for events on an array of elements using jQuery

My task involves populating an array with elements using the .each() method and the $(this) selector. (function($){ var elements = new Array(); var index = 0; $("img").each(function() { if($(this).attr("attribute")){ $(thi ...