Tips for aligning text next to a navigation bar

My website is in progress. The navigation bars and header are looking good, but I'm struggling with the alignment of the body text. How can I make my paragraphs float to the right of the navigation bar rather than being stuck below it? What CSS code should I use to achieve this?

This is what I have so far: https://i.sstatic.net/FmroX.png. I want the content following that to be positioned next to the navigation bar like this: https://i.sstatic.net/HvVqO.png.


<!DOCTYPE html>
   <html>
 <head>
<!-- Author: Abdullahi Jama 0003 -->
   <title>Cycling Tours</title>
<link rel="stylesheet" type="text/css" media="print" href="printstyles.css" >
<link rel="stylesheet" type="text/css" href="aboutus.css" >
 </head>

 <body>

<header>
    <a href="about_us.html"><img src="images/bicycle_axle_sm.jpg" alt="This is a picture of an axle"></a>
    <h1>Cycling Tours</h1>
</header>

<div class="navmenu">
    <nav>
    <ul>
        <li><a href="aboutus.html">About Us</a></li>
        <hr>
        <li><a href="#">Ask Us</a></li>
        <hr>
        <li><a href="#">Destinations</a></li>
        <hr>
        <li><a href="#">FAQ</a></li>
        <hr>
        <li><a href="#">Reviews</a></li>
        <hr>
        <li><a href="#">Seminars</a></li>
        <hr>
        <li><a href="#">Trip Prep</a></li>
        <hr>


    </ul>
    </nav>
</div>
 <div class="paragraph">
<h2>About Us</h2> 

    <p>Cycling Tours began when Bill Randolf and three of his friends from high school started cycling regularly every weekend. 
    Their routine cycling turned into frequent trips which gained popularity. Soon other friends and family members wanted to join them on these trips.</p>
    <div id="dust_jpeg">
    <img id="dustimage" src="images/dust.jpg" alt="Picture of Dust">
    </div>
    <p>Our cyclists are passionate, health-conscious, and environmentally friendly. As such, all our trips offer vegan meal options, recycled paper utensils, 
    and hybrid vehicle support for the riders.</p>

    <p>Our tours cater to solo adventurers, couples, groups of friends, and families. For off-road cycling expeditions, we provide camping facilities while shared accommodations are available for couples, friends, or families. If you're traveling alone, we can pair you up for shared lodging. 
    You also have the option to pay a single-supplement if you prefer your own room.</p>

    <p>Once you've experienced one of our tours, chances are you'll want to embark on more adventures with us. Over 80% of our customers have gone on multiple trips with us. 
    We are always open to new trip ideas, so feel free to share your suggestions!</p>

</div>

    <p id="bicycleimage"><img src="images/bicycles_sm.jpg" alt="Image of bicycles."><p>

    <hr>

    <p id="bottom_footer"><strong>Cycling Tours * P.O. Box 4455 * Brantford, ON * NET 2J0</strong><p>   
</body>
</html>




<style type ="text/css">

   header h1 {
           display: inline;
           font-size: 45px;
           font-family: arial;  
           vertical-align: 90%;
           margin: 30px;
   }

   header {
           background-color: #bbccdd;
           padding-bottom: 0px;
           height: 121px;
   }

   .navmenu{
           background-color: #bbccdd;
           width: 8.8%;
           height: 580px;
           display:inline-block;
   }
   .navmenu hr {
           border: 1px solid grey;
   }
   .navmenu ul {
           margin-top: 0;
           padding-left: 2px;
           display:inline-block;
   }
   .navmenu li {
           height: 35px;
           padding-top: 30px;
           padding-left: 10px;
           font-family: arial;
           color: grey;
           display:inline-block;

   }    
   .navmenu li a {
           color: #888888;
           text-decoration: none;
           font-weight: bold;

   }
   .navmenu a:link {
           color: #888888;
   }
   .paragraph {
           width: 60%;
           margin-left: 10%;
           border-top: 0;
           float: left;
   }

</style>

Answer №1

Position the sidebar to the left

.sidebar {
    float: left;
}

Answer №2

I have made some revisions to your html structure. Please review...

<!DOCTYPE html>
<html>

<head>
  <!-- Author: Abdullahi Jama 0003 -->
  <title>Cycling Tours</title>
  <link rel="stylesheet" type="text/css" media="print" href="printstyles.css">
  <link rel="stylesheet" type="text/css" href="aboutus.css">
</head>

<body>

  <header>
    <a href="about_us.html">
      <img src="images/bicycle_axle_sm.jpg" alt="Image of an axle">
    </a>
    <h1>Cycling Tours</h1>
  </header>

  <div class="navmenu">
    <nav>
      <ul>
        <li><a href="aboutus.html">About Us</a>
        </li>
        <hr>
        <li><a href="#">Ask Us</a>
        </li>
        <hr>
        <li><a href="#">Destinations</a>
        </li>
        <hr>
        <li><a href="#">FAQ</a>
        </li>
        <hr>
        <li><a href="#">Reviews</a>
        </li>
        <hr>
        <li><a href="#">Seminars</a>
        </li>
        <hr>
        <li><a href="#">Trip Prep</a>
        </li>
        <hr>


      </ul>
    </nav>
  </div>
  <div class="paragraph">
    <h2>About Us</h2> 

    <p>Cycling Tours originated when Bill Randolf and three high school friends began cycling together regularly on weekends. Their casual rides soon turned into planned trips, attracting more participants over time. Friends and family also joined the group.</p>
    <div id="dust_jpeg">
      <img id="dustimage" src="images/dust.jpg" alt="Image of Dust">
    </div>
    <p>Cyclists partaking in our tours are health-conscious and eco-friendly. We offer vegan meal options, use recycled paper utensils, and employ hybrid vehicles for support.</p>

    <p>Our tours cater to solo riders, couples, groups of friends, and families. Off-road cyclists can camp during their trip while others opt for shared accommodations. Solo travelers have the option to share a room or pay extra for single occupancy.</p>

    <p>After experiencing one of our tours, most customers return for another adventure. A large percentage of our clientele have taken multiple trips with us. We welcome suggestions for new tour ideas from our customers!</p>
    <p id="bicycleimage">
      <img src="images/bicycles_sm.jpg" alt="Photo of bicycles">
      <p>

        <hr>

        <p id="bottom_footer"><strong>Cycling Tours * P.O. Box 4455 * Brantford, ON * NET 2J0</strong>
          <p>
  </div>


</body>

</html>


<style type="text/css">
  header h1 {
    display: inline;
    font-size: 45px;
    font-family: arial;
    vertical-align: 90%;
    margin: 30px;
  }
  header {
    background-color: #bbccdd;
    padding-bottom: 0px;
    height: 121px;
  }
  .navmenu {
    float: left;
    background-color: #bbccdd;
    min-width: 8.8%;
    height: 580px;
    display: inline-block;
  }
  .navmenu hr {
    border: 1px solid grey;
  }
  .navmenu ul {
    margin-top: 0;
    padding-left: 2px;
    display: inline-block;
  }
  .navmenu li {
    height: 35px;
    padding-top: 30px;
    padding-left: 10px;
    font-family: arial;
    color: grey;
    display: inline-block;
  }
  .navmenu li a {
    color: #888888;
    text-decoration: none;
    font-weight: bold;
  }
  .navmenu a:link {
    color: #888888;
  }
  .paragraph {
    width: 90.2%;
    margin-left: 10%;
    border-top: 0;
  }
</style>

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

Form tag definitions are missing on the login page

Here is a snippet of code I am using: <%= form_tag :action => 'process_login'%> Username: <%= text_field "user", "fullname" %>&#x00A; Password: <%= password_field "user", "password" %>&#x00A; <%= submit_t ...

Master the Flexbox Technique to Automatically Scroll to the End

I am currently working on a Chat UI that needs to function consistently across various browsers. The main issue I am facing is the inability to keep the chat-body div scrolled to the bottom when the page loads or when new messages are added. Even after ch ...

Unusual phenomenon of overflow and floating point behavior

HTML and CSS Output Example: <div id="float_left"> DIV1 </div> <div id="without_overflow"> DIV2 </div> CSS Styling: #float_left{ float: left; width:200px; background-color: red; } #wit ...

unable to properly verify if the value is above 0

$zombieNumber = $_POST['zombie']; if ($zombieNumber > 0){ echo "The number is greater than 0"; } It appears that even if the value of $_POST is -1, the script still considers it greater than 0. Is there a way to handle values under 0? Attemp ...

Learn the effective way to customize the primary button text color in Bootstrap 4 using SCSS styling

Looking to customize the .btn-primary text color. I attempted to modify the background color in _variables.scss by adding the following line: $primary: #a1c1b6; However, I was unable to change the text color despite trying various options. // not working ...

Bootstrap modal experiencing technical difficulties

I am experiencing issues with my bootstrap modal. It seems to be malfunctioning, almost as if the CSS or JavaScript files are not being recognized. I have tried various solutions but have been unable to resolve the problem. I even attempted using the examp ...

What's the best way to display two checkboxes on a single line?

I am working with checkbox filters in WooCommerce and I want to organize them so that two checkboxes appear in one row, followed by the next two in the second row, and so on. The issue can be seen at this URL. I also want this style to apply to "Product Co ...

Use Jquery to select the checkbox inside the td element and mark it as

I've created an HTML table with checkboxes in the td elements, like so: <table id="my_table"> <tr> <td><input type="checkbox" name="td1"></td> <td><input type="checkbox" name="td2"></td> </ ...

Express is causing an issue with the AngularJS loading process

When I view the index.html file in a browser, everything works fine. However, when I try to run it on a local server using Express, it doesn't work as expected. Server.js const express = require('express'); const app = express(); app.get ...

Halt the jQueryUI Slider once a specific difference or margin has been reached

I have a specific margin or distance that needs to be changed from an HTML select option tag dynamically in the future. I have implemented a Range Slider using jQueryUI Slider. My objective: I am looking to halt the sliding action once a specific distance ...

What is the best way to test out CSS effects before they go live

I enjoy customizing the CSS, like the posted dates on my portfolio How can I make these changes without affecting the public view of the website? One suggestion from a forum was to use .date {visibility:hidden;} ...

I'm trying to understand why this code isn't running properly. Can someone explain why my CSS is not being executed?

For some reason, using button .order{} to select elements inside the button is not applying the CSS codes as expected. The text color remains unchanged. However, when using just `.order` to select the elements, the CSS code works perfectly fine. Can someon ...

Looking for assistance with eliminating the excess white space that's appearing between two div elements

Seeking assistance to remove the unwanted whitespace in my code. I have attempted to set *{margin:0} as well as for p and pre tags, but it hasn't been effective. The issue persists even though I am using BS4. Here is the snippet of the troublesome cod ...

Countdown Timer App using Flask

I'm currently working on a Flask-based game that involves countdown timers for each round. My goal is to have the timer decrease by 1 second every round without the need to reload the page. I've tried using time.sleep in my Python code to update ...

What is the best way to link various stylesheets to a Rails project?

In my project, I have a main stylesheet called application.css included in the layout file layouts/application.html.erb: <%= stylesheet_link_tag "application" %> However, there is a specific section of the website where I want to use a different st ...

Troubleshooting a POST PHP Problem

Seeking assistance with my website project! I am currently developing a website where users can input Google map information through a form, which will be saved to an SQL database using XML and PHP. While following a tutorial from the Google site on how ...

What is the best way to differentiate the behavior of two identical classes using a single JavaScript function?

Can someone help me figure out how to make two circles move differently with the same JavaScript function? I'm new to JavaScript and struggling to differentiate between classes in HTML to achieve this. My goal is to have each circle move randomly and ...

A guide on keeping the table header fixed when incorporating a navbar in Bootstrap 4

I am attempting to create a navigation bar along with a large, scrollable table that can scroll both horizontally and vertically. Despite reviewing other solutions on Stack Overflow, I am struggling to implement the same on my own website. There seems to ...

The background widths do not stretch to 100%, but rather stop right before reaching the

Experience it live: Adjust your screen width slightly to activate the mobile layout, but ensure that there is still enough room for a horizontal scroll bar. Astonishingly, all my background images stop short of this point. Innovative Fix To prevent the ...

Activate the WebDAV feature within the .htaccess file

Can WebDAV be activated through an .htaccess file? I'm experiencing issues with Plesk not recognizing my modified config files that have WebDAV enabled. Is it feasible to enable WebDAV without using an .htaccess file? ...