Using CSS to responsively align the logo in the header with the name positioned on both sides

I'm struggling to align my logo in the center of my header. I want it to appear like this when displayed correctly: "Name" Logo "Surname". The logo should be centered, with the "name" on its left and the "surname" on its right. (Please refer to the image I've attached for better understanding)

Header: logo not centered

I need the circled logo to be at the center of the header, with "Pousada" on its right and "Team" on its left.

This is the CSS and HTML I currently have:

*{
  font-family: 'Oswald', sans-serif;
 }

#rafa {
  background-color: #000000;
  background-repeat:no-repeat;
  background-position: 40% 0;
  background-size:30%;
  color: #fff;
  padding: 0.5rem 0 0 0;
  border-top:none;
  
  }
  
#BJJ {
  text-align:center;
  height: 4rem;
  font-weight: normal;

 }
 
.escudo{
  text-align:center;
 }
  
.group:after {
  content: "";
  display: table;
  clear: both;
 }
  

#uno {
  text-align:center;
  vertical-align:middle;
  font-size: 2em;
  display:inline-block;
 }

#dos {
  text-align:center;
  font-size:2em;
  display:inline-block;
  vertical-align:middle;
   
}

img {
  max-width: 15%;
  clear:both;
  display:inline-block;
  vertical-align:middle;  
}

ul {
  color: #000;
  list-style: none;
  text-align:center;
  background: #fff;
  border-bottom: solid #000 1.5px;
  padding:0;
  height: 2.5em;
  border-top:none;
 }
 
li {
  display:inline-block;
  padding: 0 1em;
  border-right: 2px;
}
  
#welcome{
  text-align:center;
 } 

li a {
text-decoration:underline;
color: #000;
}

.Inicio {
color: #fff;
text-decoration:none;
 }

<!DOCTYPE html>
<html lang="en">
  <head> 
    <meta charset="utf-8"> 
<link href="Treehouse Programación/Recursos/normalize.css" rel="stylesheet">
<link href="estilo.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oswald:300,400,700|Roboto+Condensed:300" rel="stylesheet">
    <title>Pousada Team Brazilian Jiu-Jitsu</title>
  </head>
  <body>
  <header id="rafa">
<a href="Pousada Team.html" class="Inicio">
  <h3 id="BJJ">Brazilian Jiu-Jitsu</h3>
  <div class="escudo group">
    <h3 id="uno">Pousada</h3>
        <img src="309011_3565552909659_642031164_n.jpg"/>
     <h3 id="dos">Team</h3>
  </div>
</a> 
</header>

<nav>
  <ul>
    <li><a href="Arte Soave.html">Arte soave</a></li>
    <li><a href="El Equipo.html">El Equipo</a></li>
<li><a href="La Escuela.html">La Escuela</a></li>
  </ul>
</nav>

<div id="welcome">
  <h3>Bienvenido al equipo</h3>
</div>

<div>
</div>

  </body>
</html>

Despite trying to use float, I couldn't achieve the alignment I wanted. I attempted using inline-block to align the three elements - "Pousada", "logo," and "Team" in the header.

If you can provide assistance with this specific issue or recommend any resources or project exercises to help me grasp HTML and CSS concepts such as layouts and positioning, I would greatly appreciate it. Rest assured, I am willing to reciprocate any help that I can offer.

Thank you in advance, and please don't hesitate to let me know if there's anything I can do to improve this platform.

Warm regards, Miguel

Answer â„–1

Need a quick solution? Check this out: I've included a background color in the divs for easier identification.

HTML: Start by creating your header and placing your logo inside of it. Then, nest both the first and last names within the logo div. This way, when you move the logo, the names will adjust accordingly.

<div class="Header">
  <div class="Logo">
    <div class="FirstName">FirstName</div>
    <div class="LastName">LastName</div>
  </div><!-- End Logo -->
</div><!-- End Header -->

CSS: I prefer the single-line CSS writing method. You can easily customize the dimensions of the logo div and reposition the names as needed.

.Header{position:relative; width:100%; height:300px; display:block; float:left; background:SILVER;}
.Logo{position:relative; margin:auto; width:200px; height:200px; background:BLACK;}
.Logo > .FirstName{position:absolute; top:90px; left:-100px; min-width:1em; text-align:center;}
.Logo > .LastName{position:absolute; top:90px; right:-100px; min-width:1em; text-align:center;}

You're welcome!

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

Burger menu animation activated by a single click anywhere on the page

After following a tutorial on creating an animated menu burger, I encountered a few bugs. The animation is working as intended, but it triggers no matter where I click on the page. Here is the code snippet: const toggleMenu = document.querySelector( ...

JavaScript generating HTML code causing malfunctions

I have been attempting to implement the IN Place Editing feature using JQuery. Below is the code snippet editinplace.js $(document).ready(function() { //When div.edit me is clicked, run this function $("div.editme").click(function() { // ...

Questions surrounding the proper placement of a div within a relative element

I am currently learning how to create a web template without using tables, using HTML and CSS. I have some questions regarding the positioning of elements in my template. Here is an image of how my final template should look: Next, I need to position the ...

Is it possible to execute this animation with a single click for repetitive playback?

CODEPEN const btt = document.querySelector('.btt'); btt.addEventListener('click', function(){ this.classList.toggle('anime'); }); Is there a way to achieve the desired effect with just one click? ...

Validating date of birth searches using AngularJS

When searching for a date of birth in the frontend using AngularJS, the request is being sent with a different date of birth to the backend in Spring. I am sending the date of birth in the following format: Sun Aug 15 1999 00:00:00 GMT+0530 (India Standa ...

What is the best method for choosing all children's text except for a specific tag in Selenium's XPath selector?

Here is the HTML code I am working with: <div id="content"> <h1>Title 1</h1><br><br> <h2>Sub-Title 1</h2> <br><br> Description 1.<br><br>Description 2. <br><br ...

There is a table equipped with two buttons. When using jQuery-ajax, rather than replacing the <tbody> of the <table>, it redirects the browser to the specified ajax URL

I initially simplified my code to troubleshoot, but I now realize I need to show the unsimplified code to pinpoint the issue. I am replacing the HTML and JavaScript with the "full version" and have updated my description with more details. I have a table ...

Arrange all the items in the list to be aligned on a single

Here is the code and styles I have in my project: I want to align the texts and span style. My default code looks like this: body { direction: rtl; } div { position: absolute; top: 30px; right: -100px; height: 300px; overflow-y: scroll; ba ...

TaffyDB is throwing an error message indicating that TAFFY is not recognized as a function

I am currently developing a web-based game using HTML, CSS & JavaScript within Visual Studio and utilizing TaffyDB as my database. However, I have encountered an error when trying to create a database using the TAFFY function, as it keeps showing up in the ...

What could be causing the background of the wrapper image not to display?

I am looking to add a background image specifically within the wrapper div on my website. Below is the HTML document: <!DOCTYPE html> <html lang="en"> <head> <meta charset="<?php bloginfo('charset'); ?>"> &l ...

Presenting information on an HTML webpage using the slidetoogle feature

< script > $(document).ready(function() { $("#flip").click(function() { $("#panel").slideToggle("fast"); }); }); < /script> When a button in a particular panel is clicked, I aim to display the details of that specific tuple ...

Unhook, add at the beginning, and set requirements jQuery

There are two clickable div elements that can switch classes when clicked. If the first one contains "1", it will be given a class of "active". If the second one contains "2", it will have the class "active" while removing the class from the first one. &l ...

When using Vuetify's v-select within a flexbox container, the input field appears empty and the dropdown list extends beyond its normal

I'm facing an issue with a Vuetify v-select that appears wider than intended when placed within a container set to display: flex, due to an empty input causing the dropdown to stretch out. Here's a screenshot showing the space taken up by the pr ...

What steps should be taken when a checkbox is unchecked?

Essentially, I have 3 checkboxes. When a button is clicked and the box is checked, each checkbox has a boolean that turns to true. But, is it possible to perform an action when unchecking a checkbox without needing another button to trigger an event first ...

JavaScript is throwing undefined when trying to access object properties

Here are some HTML elements that I frequently work with: <TD id=Cell.0.0> <DIV></DIV> <IMG id=_Q0_C0_mrSingleImg src="radio.gif"> <INPUT type="checkbox" na ...

In what ways can the use of !important cause issues for website users?

When it comes to accessibility, is using !important not the best practice? In what ways can the use of !important cause problems for site users? ...

Is using canvas the best option for creating simple image animations with JavaScript?

I am currently working on a basic animation project using JavaScript. This animation involves switching between 13 different images per second to create movement. I have created two simple methods for implementing this animation. The first method involves ...

Ensure that text and images are perfectly aligned along a single vertical line

I have the following code snippet using Bootstrap 4:- <div class="container"> <div class="row "> <div class="col-xl-12"> <img src="~/img/img1.png" style="height:60.3px;width:750px" class="mx-auto d-none d-sm-bl ...

What is the best way to toggle the visibility of select tags using another select tag?

I have a piece of code with one parent select tag containing two options: apples and butter. Each option has a value of 1 and 2 respectively. When I select apples, another select tag should appear, and vice versa. However, my issue is that multiple select ...

Maximizing the potential of jquery.animate when implementing page scroll following an ASP.NET postback with MaintainScrollPositionOnPostback

I've been working on implementing a "Page scrolling animation" that triggers after a user clicks on my ASP.NET button. Here's the approach I took: String script = "<script type=\"text/javascript\">" + "\n" + ...