Having trouble getting the image and text to line up correctly

Struggling to create a certificate using HTML and CSS, I am facing issues with aligning text and images. Can anyone provide assistance in achieving the design shown in the image above?

Here is my current code:

<!Doctype>
<html>
<head>
  <style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
  position: relative;
  text-align: center;
  color: white;
}

    .l1
    {
      position: absolute;
      top: 100px;
      left: 200px;
      
    }
     .l2
    {
      position: absolute;
      top: 100px;
      left: 200px;
      
    }
    
    .centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
  </style>
</head>
<body>

  <div  class="container">
    <img src="l3.jpg"  height="600"  class="l3"/>
    <img src="l1.png" style = "align:left" width="100" height="100" class="l1"/>
    <img src="l2.png" style = "align:right" width="100" height="100" class="l2">
    
    
   <div class="centered"  style= "color: lightblue" >This is to certify that the building described herein has been inspected and confirms substantially to the approved drawings & to the requirements of all the applicable codes, laws, rules and regulations that were in place at the time of the issue of this certificate.</div>
    </div>
  
</body>
</html>

Answer №1

It seems like you are searching for a layout similar to this (Feel free to rearrange the images as needed) https://i.sstatic.net/10tWB.png

If this is what you were looking for, here is the code snippet

<!Doctype>
<html>

<head>
  <style>
    <meta name="viewport"content="width=device-width, initial-scale=1"><style>.container {
      position: relative;
      text-align: center;
      color: white;
    }

    .l1 {
      position: absolute;
      top: 100px;
      left: 200px;
    }

    .l2 {
      position: absolute;
      top: 100px;
      left: 700px;
    }

    .l3 {
      position: absolute;
      top: 100px;
      left: 500px;
    }

    .centered {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  </style>
</head>

<body>

  <div class="container">
    <img src="l3.jpg" height="600" class="l3" alt="img3" />
    <img src="l1.jpg" style="align:left" width="100" height="100" class="l1" alt="img1" />
    <img src="l2.png" style="align:right" width="100" height="100" class="l2" alt="img2" />

    <div class="centered" style="color: lightblue">This document certifies that the building mentioned herein has been examined and complies with the approved plans and all relevant codes, laws, and regulations applicable at the time of issuance.</div>
  </div>

</body>

</html>

To achieve the desired layout, you can adjust the left attribute values of the elements with absolute positioning to prevent them from overlapping. I hope this helps clarify your query.

Answer №2

.container {
  position: relative;
  text-align: center;
  color: white;
  display: flex;
}

.l3 {
  width: 100%
}

.l1 {
  position: absolute;
  top: 100px;
  left: 2;
}

.l2 {
  position: absolute;
  top: 100px;
  right: 8px;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
<div  class="container">
  <img src="https://picsum.photos/id/237/200/300"  height="600"  class="l3"/>
  <div class="centered"  style= "color: lightblue" >This building has been inspected and complies with all relevant laws, codes, rules, and regulations.</div>
</div>
<img src="https://picsum.photos/id/237/200/300"  style = width="100" height="100" class="l1"/>
<img src="https://picsum.photos/id/237/200/300" style =  width="100" height="100" class="l2"/>

Answer №3

Upon my initial observation, I quickly noticed that the meta element is nested within the style tag. Furthermore, it appears that you have duplicated your content at the start of the document.

Handy Tip: When starting a new HTML file, simply type '!' and press Enter to generate a basic template for quicker development. This shortcut can be quite beneficial.

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

"Troubleshooting: When using the Script tag in EJS, conditional IF statements may not function

I encountered an issue here. I placed a script tag inside an IF conditional statement. However, the script tag runs whether the condition is TRUE or FALSE. For instance: <% if (info) { %> <p><%=info%></p> <scrip ...

What is the best way to make a div expand to the full width of the screen while still being contained within its parent div?

I am facing an issue with the black bar at the bottom of the slider not stretching full-width on the screen. While it works fine on the left, the right side is cut off at the container edge. I am using Master Slider if that's relevant information. Can ...

What is the best way to display a message when a record cannot be found?

I have created a HTML PHP table page with full codes. The code is working fine, but I am facing an issue where it doesn't display anything if the record does not exist. I want to show a message when the record does not exist. <!DOCTYPE html> < ...

Utilizing PHP to create a form via email

I have created this form and I would like to know if it is secure enough. I attempted multiple times to implement a captcha system, but unfortunately, it did not work for me. As I am still a student, please refrain from sending overly complex solutions. Q ...

Switch from hover effects to CSS3 animations triggered on page load

I found this code snippet on https://codepen.io/chriscoyier/pen/NWNJpdJ. Can someone help me modify it to change the counter on page load instead of hover? Also, I want the counter to stop at 100 without resetting back to 0. @property --num { syntax: ...

Email Markup: !mso conditional tactic

As a newcomer to HTML Email Development, I've been diving into dissecting HTML Emails on "reallygoodemails.com" in order to enhance my understanding of HTML Email structures. During my exploration, I stumbled upon four different methods for creating ...

Increasing the size of the entire page can be achieved using the three.js dom element

I am currently working on creating a 3D viewer using three.js. My goal is to have the viewer take up the full height of the screen while also leaving space for a side panel. The vertical layout is functioning properly, but once I add the render's dom ...

The use of dates (YYYY-MM-DD) as identifiers in HTML/Angular 2 is causing issues

I have successfully created a calendar using html in Angular 2, and now I am looking to incorporate events into it. These events should be able to color specific days, add a dot inside the cell, or something similar. I have a json file that contains the ev ...

Restrict the reach of CSS on a single webpage

I'm facing an issue with a webpage where I can define an HTML template using a modal editor, and then this template is inserted into a div for preview purposes. The text area within the template may contain HTML/CSS (and possibly some JavaScript). Th ...

Using PHP, retrieve the current location on the map and save the information to a database using AJAX and PHP

This code snippet allows you to fetch the current location, display it on the browser, and then save it to a database using PHP, JavaScript, and AJAX. HTML PAGE - index.html <!DOCTYPE html> <html> <head> <title></title> ...

A guide on incorporating a customized Google map into your website

Recently, I utilized the Google Map editing service from this site: https://developers.google.com/maps/documentation/javascript/styling This link provided me with two things: 1. A JSON code 2. The Google API link However, I am unsure about how to incorpo ...

Searching tables with Angular

Looking to search for specific information in my table under the column SN. Although I want to filter based on SN, when I try adding the filter option, my table does not load at all. This is what I attempted: In my controller, I populated my List: $sco ...

Obtain anchor text with Selenium and Java programming language

Having an issue extracting the text from a link. While browsing a website, I encountered the following link: <a href="DetailsZZ-10048.html">ZZ-10048</a>. The part with ZZ- remains constant, but the number following it varies and is u ...

The Cascading of Bootstrap Card Designs

Looking for some assistance with my TV Show Searcher project that is based on an API. The functionality is complete, but I'm struggling to get the Bootstrap cards to stack neatly without any empty space between them. I want it to resemble the image ga ...

Ways to align text within a table cell on a background using CSS

I'm attempting to print jukebox strips with designated corner markings. The code I have written generates the HTML page for displaying the strips, allowing users to then print them. Jukeboxes typically feature selection buttons labeled ABCDEFGHJK and ...

The jQuery keyup event initiates multiple times, increasing exponentially with each trigger

I recently added a search bar with auto-complete functionality to my website. The search bar queries the database for elements that begin with the text entered by the user as they type. Although it works well, I noticed that every time the user inputs ano ...

Upon submission of the form, trigger an email to be sent and simultaneously open a

I need my form to simultaneously open a window and send the form data via email when submitted. <form action="" method="post" id="form" onsubmit="paymentfunc();return false;"> Submit button: <input type="submit" value="Purchase" class="btn" id= ...

Ensuring the Line Breaks in CSS and JavaScript to Easily Modify the Style

Is there a way to determine when a line will break so I can apply different styles? The design team needs 3 buttons in a grid (3 columns) with specific sizes. They want buttons with content that breaks onto the next line to have a border-radius of 13px, w ...

CSS Navigation buttons shifted to the lower left corner

The navigation buttons are positioned on top of the image title section. They both drop down when hovered over. However, when moving to the next image, the navigation buttons appear correctly. But clicking on the previous button causes the entire navigatio ...

When applying the 'aspect-ratio: 1' property to create square cells, the 3 by 3 CSS Grid exceeds the boundaries of the container with overflowing squares

After countless attempts and hours of tweaking, my goal remains to create a 3x3 grid composed of squares that adjust to fit the content inside. I also want each square to have a corner number, with text content centered both vertically and horizontally. De ...