Issues with CSS causing items to not line up in a single row

I'm currently working on an html/css page and trying to align the items of the agenda class in the same row, centered on the page.

https://i.sstatic.net/8TjG8.png

Here's the code I've been using:

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta charset="utf-8" />
  <title>Fishing Guide Santos</title>
  <link href="css/Style2.css" rel="stylesheet " />
  <style>
    .img {
      height: 150px;
      width: 150px;
      object-fit: cover;
      float: left;
    }
    
    .whatsapp {
      position: fixed;
      bottom: 200px;
      right: 50px;
      z-index: 9999;
    }
    
    .menu {
      display: flex;
      align-items: center;
    }
    
    .container {
      background-color: khaki;
      height: 100vh;
      margin: 5%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
  </style>

  <meta name="viewport" content="width=device-width" , initial-scale=1.0, maxime-scale=1.0>

</head>

<body>
  <header>
    <div class="center">
      <div class="logo"><img src="img/logoDan.jpeg" class="img" />
      </div>
      <!--Logo-->

      <div class="menu">
        <!--Menu-->
        <a href="Index2.html">Home</a>
        <a href="Embarcacoes.html">Boats</a>
        <a href="Agenda.html">Agenda</a>
        <a href="Galleria.html">Gallery</a>
        <a href="Contato.html">Contact</a>
      </div>

    </div>
    <div class="agenda">

      <a href="#catalog">Xu</a>
      <a href="#about">Xalana</a>
      <a href="#feature">Free Willy</a>
    </div>
  </header>
  <div class="whatsapp">
    <a href="https://wa.me//5511950758677? 
         text=Hello!_Would_you_like_to_go_fishing_with_us" target="_blank">

      <img src="img/124034.png " width="100" hight="100" alt="Call us on WhatsApp" title="Get in Touch" />
    </a>
  </div>
  <div class="container">

  </div>
</body>

</html>

As well as this css style page:

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.header {
  padding: 20px 0;
  display: flex;
  flex-direction: row;
}

.center {
  display: flex;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2%;
}

.logo {
  width: 50%;
  text-align: right;
}

.menu a {
  top: 100px;
  color: black;
  text-decoration: none;
  font-weight: bold;
  margin-right: 15px;
  display: flex;
  align-items: center;
}

.barcos a {
  top: 100px;
  color: black;
  text-decoration: none;
  font-weight: bold;
  margin-right: 15px;
  display: flex;
  align-items: center;
}

nav ul {
  display: flex;
  flex-direction: row;
}

nav ul li {
  list-style: none;
  padding: 10px;
  cursor: pointer;
}

.agenda a {
  top: 100px;
  color: black;
  text-decoration: none;
  font-weight: bold;
  margin-right: 15px;
  display: flex;
  flex-direction: row;
  align-items: center;
}

Can anyone help me figure out why XU, Xalana, and Free Willy are not displaying on the same row like the "menu" class items?

Thank you for any assistance.

Answer №1

.agenda{
  display: flex;
  gap: 15px;
  width: 100%;
  justify-content: center;
}

.agenda a {
  color: black;
  text-decoration: none;
  font-weight: bold;
}
<div class="agenda">
  <a href="#catalog">Xu</a>
  <a href="#about">Xalana</a>
  <a href="#feature">Free Willy</a>
</div>

Answer №2

Getting back to basics, you can use the inline-flex property on the child DIV elements within the header and then add styles to their children.

header{
  display:flex;
  flex-direction:row;
  justify-content: center;
  align-items: flex-start;
}
header > div{
  display:inline-flex;
}


header > div > *,
header > div > div > *{
  margin:0.25em
}
<header>
  <div class="center">
    <div class="logo"><img src="img/logoDan.jpeg" class="img" /></div>
    <div class="menu">
      <a href="Index2.html">Home</a>
      <a href="Embarcacoes.html">Embarcacoes</a>
      <a href="Agenda.html">Agenda</a>
      <a href="Galleria.html">Galeria</a>
      <a href="Contato.html">Contato</a>
    </div>
  </div>

  <div class="agenda">
    <a href="#catalog">Xu</a>
    <a href="#about">Xalana</a>
    <a href="#feature">Free Willy</a>
  </div>
</header>

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

Learning how to effectively incorporate two matSuffix mat-icons into an input field

I'm currently experiencing an issue where I need to add a cancel icon in the same line as the input field. The cancel icon should only be visible after some input has been entered. image description here Here's the code I've been working on ...

Seeking assistance with coding a beginner-level Google Chrome extension

Currently, I am working on developing a basic Google Chrome extension with 2 or 3 browser actions. I have been using Selenium IDE to capture the necessary steps in Firefox that I need for my project. However, I am unsure of how to translate these recorde ...

What is the best way to rearrange a sidebar column to be positioned between central content columns on a mobile

I am looking to design a layout with the following components: Left Sidebar Main Content Right Sidebar Extra Content My goal is to achieve the following: On larger screens: Ensure that the "Extra Content" aligns directly below the main content with the ...

Attempting to determine which PHP form was submitted

I'm currently working on creating multiple forms within the same page, but I've encountered an issue where the PHP code is not executing properly when attempting to submit the form. <form id="DeleteEmployeeModal" name="DeleteEmployeeModal ...

Optimal Procedure for New Users Form (Jade / Angular) in HTML

I'm currently working on integrating a form into my app for users to create tasks. This form should only appear the first time a user attempts to create a task. As someone who is not very experienced with frontend development, I find myself wondering ...

Top method for removing quotation marks from form input using jquery

Here is a form input that I need to handle: <tr class="formulaRow"> <input type="text" class="ingredient required" name="ingredient"> </tr> Currently, the value from this input is stored as follows: var ingredient = $(".formulaRow").fi ...

Mapping the Way: Innovative Controls for Navigation

Currently, I am utilizing the HERE maps API for JavaScript. However, I would like to customize the design of the map controls similar to this: Below is an example for reference: HERE EXAMPLE Is it feasible to achieve this customization? ...

Element sticking on scroll down and sticking on scroll up movements

I am currently working on a sticky sidebar that catches and stays fixed at a certain scroll point using JavaScript. However, I am facing an issue where I need the sidebar to catch when scrolling back up and not go further than its initial starting point. ...

Customizing event colors in Full Calendar

My interactive calendar is created using : $('#calendar').fullCalendar({ height: 300, //............. events: jsonData, month: firstMonth }) I am looking to dynamically change the color of an event based on certain conditions ...

Encountering an 'undefined' error while attempting to showcase predefined JSON data on an HTML webpage

As I try to display the predefined JSON data from https://www.reddit.com/r/science.json on an HTML page, I keep encountering the message "undefined." Below is a snippet of my HTML code: $.getJSON('https://www.reddit.com/r/science.json', funct ...

Issue with font-size changes using css variables in Angular not updating in browser for specific fields

Utilizing CSS variables, I have implemented a feature that allows users to adjust the font size to small, medium, or large. While this functionality works correctly for most fields, there are certain instances where the value is applied but not displayed. ...

Enhancing modal interactions with modal pop-ups

I've been experimenting with different modal effects for a modal popup, following the examples on this site: https://tympanus.net/codrops/2013/06/25/nifty-modal-window-effects/ Here is my code snippet: <div class="md-modal md-effect-1" id="modal- ...

Fade In/Out Scroll Effect

As the user scrolls down the page, I have a slider that smoothly slides from right to left. What I'm trying to achieve is for the slider to fade out when the last slide is no longer in view during downward scrolling, and fade back in as the last slid ...

Prioritize the Menu display

Is there a way to bring the menu's black background in front of the body text in the image below? Here is the JSFiddle link for reference: https://jsfiddle.net/johnking/j58cubux/6/ The issue occurs when scrolling down and the menu is not clearly vi ...

Automate web page interactions using Python Selenium to duplicate a class

Is there a method to duplicate a class? view image description here Upon examining the data-sitekey, I aim to replicate everything following it, namely 6Ld_LMAUAAAAAOIqLSy5XY9-DUKLkAgiDpqtTJ9b. Is this feasible? ...

Adjusting the width of input textboxes for alignment

I currently have a set of input textboxes that I have attempted to align using CSS with the {width: xxx px;} property. However, this method is unreliable as it does not consistently ensure proper alignment. <style> #left_col p { margin-top: 15px ...

Why isn't the content of the initial tab in a <section> shown when clicking a link in the side-drawer?

View the JSFiddle here. Within this MCVC, a side drawer is implemented (opened by clicking the top left button) that contains three labeled links: Link One, Link Two, and Link Three. Each link has an href attribute value that starts with "#" concatenated ...

Guide on creating a live connection between a slider and a canvas

Currently, I am working on implementing a slider that can dynamically adjust a specific value in the canvas, such as the radius of a circle. Although my code works as intended, I would like the canvas to update in real-time as I move the slider instead of ...

Is it possible to perform a CSS flip animation without delay?

Trying to implement David Walsh's CSS flip effect for an image that should change to another without requiring a mouseover. Is there a way to trigger it automatically, maybe in 3 seconds? I'm new to this so any help would be greatly appreciated! ...

Display additional tiles within a compact container

I'm attempting to replicate the user interface used by foursquare! Positioning the map slightly off center like they have . I've figured out how to do one part but struggling with the second part. Initially, I loaded the map in a small div (t ...