What is the best way to display a logo on top of an image with absolute positioning?

My goal is to position my site's logo 50% from the top and 8% from the left. Take a look at what I have accomplished so far here. Any suggestions on how I can achieve this?

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="css/signin.css">
   <link rel="stylesheet" href="css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

  <style>
  body { background: url(images/bg.jpg); }
  input { width: 200px;  }
  <style type="text/css">
html, body {
  overflow: hidden;
}
a:hover{
    color:#FFFFFF;
}
</style>
</head>
<body>
<img style="position:absolute;left:0%;top:0%;" src ="images/vector.png"></img>
<img style="position:absolute; margin: 25% 1% 1% 8%" src="images/logo.png"></img>
<div class="container">
  <div class="row">
    <div class="col-sm-4" style="float:right;color:#000; margin-top: 2%; width: 45%;">
      <h3 style="color:#ff9c00"><strong>Login</strong></h3>
 <form role="form" style="color:#FFF;">
    <span class="form-group">
    <!--
      <label for="email">Email:</label>
      -->
      <input style="  width: 46%;
  float: left;
  margin-right: 4%;" type="email" class="form-control " id="email" placeholder="Enter email" >
    </span>
    <span class="form-group">
    <!--
      <label for="pwd">Password:</label>
      -->
      <input style="width: 50%;
  float: left;" type="password" class="form-control" id="pwd" placeholder="Enter password">
    </span>
    <br><br>
    <button type="submit" class="btn btn-default">Login</button>
    <p style="float:right;"><a href="#">Forgot your password</a></p>
  </form>
<br><br><br><br>
  <h3 style="color:#ff9c00"><strong>Register an Account</strong></h3>
 <form role="form" style="color:#FFF;">
    <div class="form-group">
        <label for="usr">Full Name:</label>
  <input type="text" class="form-control" id="usr">
    </div>
        <div class="form-group">
      <label for="email">Email:</label>
      <input type="email" class="form-control" id="email" placeholder="Enter email">
    </div>
    <div class="form-group">
      <label for="pwd">Password:</label>
      <input type="password" class="form-control" id="pwd" placeholder="Enter password">
    </div>
        <div class="form-group">
      <label for="pwd">Confirm Password:</label>
      <input type="password" class="form-control" id="pwd" placeholder="Enter password">
    </div>
    <div class="form-group">
      <label for="usr">Mobile Number:</label>
  <input type="text" class="form-control" id="number">
    </div>
    <button type="submit" class="btn btn-default">Signup</button>
  </form>
</div>



    </div>

  </div>
</div>

</body>
</html>

Answer №1

Perhaps you could try it this way

Percentage (%)

<img src="images/logo.png" style="position: absolute; top: 50%; left: 8%">

Pixels (px)

<img src="images/logo.png" style="position:absolute; top: 280px; left: 80px">

Note: Removing padding from the body might enhance the appearance.

Answer №2

Here's a different approach

<img src="images/logo.png" style="position:absolute; margin: 13% 1% 1% 5%">

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

The content from http://x.com/js/bootstrap.min.js.map could not be retrieved due to an HTTP error with a status code 404, showing a net::ERR_HTTP_RESPONSE_CODE_FAILURE

I'm working on an HTML CSS Website and encountering a consistent error. Some solutions suggest using Developer Tools in the browser to resolve it, but after trying multiple browsers, I suspect the issue lies within the code itself. Can anyone offer as ...

Expanding Column Width Dynamically with Bootstrap When Text is Added

My HTML Code presents a challenge that I need help with: <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.mi ...

Different strategies for displaying a singular pie chart on multiple pages

I have implemented a pie chart on an HTML page and now I want to display this chart on multiple other HTML pages. Below is the JavaScript code for creating the pie chart: function piechart() { var chart; var legend; ...

Troubleshooting issues with my Bootstrap 4 responsive column layout

I recently created a basic responsive website layout with Bootstrap 4. It should display 4 columns when in tablet mode, which is when the viewport is 768px wide. However, my layout works fine up to 770px, showing 4 columns. But as soon as it hits 769px, it ...

What is causing the lack of response in the select box on Mac Chrome when I try to click on it?

Similar Question: JQuery function doesn't work on Chrome on Mac, but works on Chrome on Win 7 and all other browsers I am encountering an issue with a select-option list <div class="social-option"> <select name="hex_theme_options[soc ...

Place elements at the bottom of a webpage on any browser or device with just a single page

I am in the process of creating a website that features a top menu and a background image with text on the home page, covering the full screen. However, I also need to include 3 blocks at the bottom of the screen that should display consistently across all ...

The CSS selector "not:nth-child" is failing to function properly within the template

Trying to apply a margin-top to all labels except the first one in a row using the :not() and :nth-child selectors. Having trouble with my selector, can anyone help? .form-group:not(:nth-child(1)) + .label { margin-top: 20px; } <div class="form- ...

Performing a search in Django using raw MySQL commands

I am currently in the process of developing a custom search engine that includes 4 search fields, aiming to search within a MySQL table. This snippet from my views.py covers the search functionality, pagination, and listing of the entire table data. def ...

Is there a way to transform an HTML canvas into a tangible photograph?

I am currently working on converting HTML content into a real image on the client's side. After conducting research on canvas2base64, canvas2base64, and html2base64 on Stack Overflow, I have found that the generated images are always based on base64 c ...

Is it possible to embed a Blazor component as a Web Component in a standard HTML page that is not using Blazor?

Is there a way to render a Blazor component as a standalone DOM fragment, or integrate it as a standard Web Component in a vanilla HTML/JS page? This question may seem simplistic from the perspective of Blazor architecture. While I'm no expert in Bla ...

SVG images are not perfectly aligned with surrounding elements, causing a noticeable discrepancy, which becomes even more pronounced when they are being animated

I've been experimenting with creating animated 3-D bars in a bar graph. To ensure there are no issues with stretching or aspect ratio, I decided to split each bar into three parts: (1) an SVG for the top of the bar, (2) a div with adjustable height fo ...

Ways to modify the hue of an li element in the context menu upon hovering

I'm currently working on a project that involves VueJS and Bootstrap. To enhance user experience, I've incorporated a context menu using the npm package called vue-context Vue Context Menu When a user hovers over an item on the context menu, the ...

Tips for customizing the appearance of a label when a MUI Radio Button is selected

Hello everyone, I am attempting to customize the label text color of a radio button to turn blue when selected. https://i.stack.imgur.com/btSc2.jpg HERE IS THE CODE FOR MY MUI BUTTON SO FAR import * as React from "react"; import Radio from &quo ...

The output from the Python and SQLite combination is accurate, however the HTML rendering is not displaying the data correctly

Retrieving data from a database using different methods can yield varied results. When the method is set to 'get', it returns all information, but when it's 'post', it only returns the searched item. Although the post method return ...

Unusual problem with table background hues in Internet Explorer 9

I am currently facing a strange issue while trying to make HTML work in an email (Outlook 2010). During my testing process, I noticed that the table with the class header does not display its background color in Outlook as expected. The background color i ...

Update the content of a table using jQuery/Ajax without needing to refresh the entire page

I've been exploring various jQuery/Ajax discussions on stackoverflow regarding the refreshing of tables without having to reload the entire page. Despite this, I have encountered an issue where the table still reloads itself. Is there a way to simply ...

`Nginx with a touch of material design`

Currently, I'm in the process of implementing material design UI on a functioning web application. The application utilizes Nginx, PHP, and PostgreSQL. While I have proficiency in PHP and PostgreSQL to ensure the functionality (code composed in notepa ...

Using PHP variables within the writeHTML() function in TCPDF

I'm attempting to include 3 different HTML strings in a PDF using TCPDF I have 3 variables that hold HTML strings. However, the code below only writes the value of $var3 to the PDF. Is there a way to display the values of all 3 variables in the PDF ...

Placing an image within a table row that spans multiple rows to maintain center alignment in relation to other rows that are not span

Having trouble with centering the image in an email signature when viewed in GMail. The layout works fine in JSBin but appears uneven in GMail. Any suggestions on how to make sure it stays centered? Check out the code here https://i.sstatic.net/F2LXV.png ...

Troubleshooting a lack of color in the D3 and Leaflet Circle SVG element

I need to showcase some SVG circle elements on a map using d3. Here is the code for one of the circles positioned over Rome, styled with D3 attributes: var feature = g.append("circle") .style("stroke", "#006600") .style("fill", "#00cc00") .at ...