Struggling with arranging elements in HTML and CSS

I'm currently working on a demonstration site, and I'm running into some challenges trying to position the aside element right next to the section paragraphs. While I can move the aside to the right, there seems to be an obstacle preventing it from moving upwards.

If someone could take a look at this and identify any margin errors or other mistakes I've made that might be causing this issue, I would greatly appreciate it.

<!DOCUTYPE html>
<html>
    <head>
    <title>The J-Prop Shop</title>
    <link href="jpsstyles.css" rel="stylesheets" type="text/css" />

<!-- The J-Prop Shop Sample Page
     Author: Alejandro Muratalla
     Date: 8/20/18 -->

        <style>

            /* CSS styling goes here */

        </style>
    </head>
<body>


</body>
</html>

Answer №1

The <section> tag for the left content is missing its closing tag.

To see the difference, you can check out this example where the section tag is properly closed before opening the aside.

Answer №2

If your code is riddled with syntax errors, fear not! The key to rectifying and preventing these mistakes lies in enhancing the readability of your code. By formatting it properly, you can easily identify and fix errors that may be lurking within.

For beginners seeking guidance on code formatting, utilizing tools like the "Tidy" feature on platforms such as JSFiddle can be immensely helpful. This feature not only formats your code but also highlights obvious errors in red for easy detection.

If navigating HTML tags or CSS properties seems daunting, fret not! Websites like W3Schools offer a comprehensive and user-friendly resource to aid your understanding.

You may have successfully shifted the aside element to the right, but an obstacle seems to impede its upward movement.

To optimize the positioning of users' comments on the right-hand side, I strongly advise leveraging the CSS Flex property. Not only does this simplify the process, but it also prevents content overflow into your footer area. Additionally, removing the margin from comments ensures they don't obstruct other content on the left.

CSS flex version: Here showcases a functional iteration of your site, although room for improvement remains.

CSS float version: I've meticulously combed through your code, flagging syntax errors via annotations:

html {
  background-color: #f4f4f4;
}

#heading {
  color: #0095f0;
  font-family: cursive;
  font-weight: bold;
  /* MISTAKE */
  /* 'white-space' instead of 'wrap' */
  /* wrap: no-wrap; */
  white-space: no-wrap;
  /* MISTAKE */
  /* 'font-size' instead of 'text-size' */
  /* text-size: 60px; */
  font-size: 18pt;
  text-shadow: 2px 2px #000000;
}

#heading2 {
  font-family: cursive;
  font-weight: bold;
  /* MISTAKE */
  /* 'white-space' instead of 'wrap' */
  /* wrap: no-wrap; */
  white-space: no-wrap;
  /* MISTAKE */
  /* 'font-size' instead of 'text-size' */
  /* text-size: 60px; */
  font-size: 18pt;
}

h2 {
  font-family: cursive;
}

p {
  font-family: Lucida Grande, sans-serif;
}

...

/* Additional content for brevity */

...

footer address {
  /* MISTAKE */
  /* 150% causes your site to be larger than the screen! */
  /* width: 150%; */
  width: 100%;
  clear: left;
  font-size: 0.8em;
  font-style: normal;
  font-variant: small-caps;
  border-top: 1px solid black;
  background-color: rgb(255, 177, 255);
}


/* More styles and closing tags */

<!DOCUTYPE html>
<html>
<head>
  <title>The J-Prop Shop</title>
  <link href="jpsstyles.css" rel="stylesheets" type="text/css" />
 ...

 </aside>
  <footer>
    ...
  </footer>
</body>
</html>

Explore further:

Feel free to refer back to this guide as you refine your coding skills. -Minding

Answer №3

The issue at hand:

I have successfully moved the aside element to the right, but for some reason, it won't budge upwards.

Quick fix:

You forgot to close the section tag.


Here is a snippet of code that demonstrates a functional demo tailored to your requirements:

<html>
    <head>
    <title>The J-Prop Shop</title>
    <link href="jpsstyles.css" rel="stylesheet" type="text/css" />

<!-- The J-Prop Shop Sample Page
     Author: Alejandro Muratalla
     Date: 8/20/18 -->



        <style>

        html{

             background-color: #f4f4f4;


        }

        #heading{

            color: #0095f0;
            font-family: cursive;
            font-weight: bold;
           white-space: no-wrap;
        font-size: 60px;
        text-shadow: 2px 2px #000000;

        }


        #heading2{


            font-family: cursive;
            font-weight: bold;
            white-space: no-wrap;
        font-size: 60px;


        }

        h2{
               font-family: cursive;
        }


        p{
          font-family : Lucida Grande , sans-serif; 
        }






body {
margin: 0px auto;
padding: 0px;
line-height: 1.5em;
width: 98%;
max-width: 980px;
min-width: 250px;
font-family: Verdana, Geneva, sans-serif
}

header {
width: 100%;
text-align: center;
}

section {
width: 66%;
float: left;
}

aside {
width: 45%;
margin-top: 2em;
float: up;
border: 3px solid black;
background-color: rgb(255, 177, 255);
-moz-border-radius: 35px;
 border-radius: 35px;
box-shadow:10px 10px 20px #000;
-webkit-box-shadow:10px 10px 20px #000;
-moz-box-shadow: 10px 10px 20px #000;
margin-left: 650px;
margin-top: 10px;
}

footer {
clear: left;
width: 100%;
text-align: center;
margin-top: 5px;
}

footer address {
width: 150%;
clear: left;
font-size: 0.8em;
font-style: normal;
font-variant: small-caps;
border-top: 1px solid black;
background-color: rgb(255, 177, 255);
}

/* Block Styles */
h1, h2, h3, h4, h5, h6 {
font-family: Arial, Helvetica, sans-serif;
}

header h1 {
margin: 1em 0em;
font-size: 2em;
}

h2 {
margin: 1em 0em;
font-size: 1.5em;
}

header h1 {
margin: 0px;
}

header h2 {
font-size: 1.2em;
font-style: italic;
margin: 0em;
padding-bottom: 0.5em;
border-bottom:1px black solid;
}

article p {
margin: 0.2em 0.9em 0.7em 0em;
}

article ul {
margin: 0.1em 0.8em 0.5em;
}

article ul li {
margin-right: 0.5em;
}

aside h2 {
text-align: center;
}

aside p {
font-size: 0.8em;
margin: 0px 0.7em;
}

aside blockquote {
margin: 1.2em 2em 0em 2em;
}

aside blockquote p {
margin: 0em 0em 2em;
font-size: 0.7em;
}





        </style>
    </head>
<body>
<header>

<hgroup>
<h1><img src="jpslogo.png" alt="The J-Prop Shop" align="center" id="" /></h1>
<h2 align="center" id="heading2">Quality Juggling and Circus Props</h2>
</hgroup>

</header>

<section>

<article>
    <h2>Welcome</h2>
    <p>If you're looking for high-quality, hand crafted
    juggling and curious products, the J-prop Shop is
    the store for you. I've designed and built props
    for the past 35 years, and my products have been
    used by professional entertainers and hobbyists
    through out the world. Our prices are reasonable
    and our quality is excellent.</p>
</article>

<article>
    <h2>Specials This Month</h2>
    <p>
    The following devil sticks are available at a
    special discount for the entire month of may:
    </p>
        <ul>
            <li><strong>Basic Stick ($19.95)</strong>
                The easiest stick to learn with, 
                    but "grippy" enough for the most
                    demanding tricks. Comes in red,
                green, and blue.

            </li>

            <li><strong>Flower Stick ($24.95)</strong>
                A graceful stick with colored tassels.
                Flower sticks float slowly, making them
                ideal for beginners.
            </li>

            <li><strong>Glow Stick ($29.95)</strong>
                The Glow Stick shines brightly at night
                (without the danger of a fire stick)
            </li>
        </ul>
</article>

<article>
    <h2>Quality Tested</h2>
    <p>
    Every item I create is checked and tested before
    being shipped out to assure perfect quality.
    I take pride in every one of my juggling
    props and I want my customers to feel that
    same pride
    </p>
</article>
</section>
<aside>
    <h2>Customer Comments</h2>
    <p>
    Here are a few select quotes from our happy 
    family of our customers and associates:
    </p>
        <blockquote>
        <p>
        "I'm more than happy to recommend Dave Vinet's products.
        I came upon his work 10 years ago and was immediately
        impressed by his craftsmanship. He provides well-
        balanced and attractive props which are the perfect
        complement to my performances."
        <cite> &#8212; 
        <br />Thomas Gage, Circus England</cite>
        </p>

        <p>
            "Dave Vinet makes the best juggling equipment on the
        planet. Period."

        &#8212; <cite>Douglas Pederson, Street-Wise Shows</cite>
        </p>


        <p>
        "David has been my main supplier for 20 years. I have
        never had a problem with his equipment and his service
        is impeccable."
        <cite> &#8212; Linda Unger , Linda & Louis</cite>
        </p>

        </blockquote>
</aside>

    <footer>
       <address>
       The J-Prop Shop
       541 West Highland Drive
       Auburn, ME 04210
       (207) 555 - 9001
       </address>
    </footer>


</body>
</html>

A few additional pointers:

  • Remember to close all tags properly. Self-closing tags should be written with a space and a forward slash at the end, like this: <meta charset="utf-8" />.
  • There is no CSS rule called "text-size"; it should be corrected to "font-size".
  • There is no CSS rule named "wrap"; it should be changed to "white-space".

Hopefully, these corrections will help you make progress.

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

Create a stylish card layout using Bootstrap featuring a 3D icon design

I am currently working on accomplishing this layout using Bootstrap 4 along with some custom CSS styles. https://i.sstatic.net/t3tot.png This is the code I have implemented so far: <div class="container"> <div class="row"> ...

What are some effective strategies for keeping content from shrinking in a drawer menu?

I am currently using a tutorial from https://www.w3schools.com/howto/howto_js_sidenav.asp to create a drawer sidebar menu. However, in my scenario, I need to include a wall of text instead of <a> links. The issue I am facing is that the text expands ...

Utilize Selenium to load the innerHTML of the HTML body tag

Looking for a way to load the HTML body into a selenium bot? html.body.innerHTML = .responseText ' Set bot = New Selenium.ChromeDriver bot.Get HERE Wondering if it's possible to accomplish this task without saving the html body to a file first ...

Creating a responsive loading button using Bootstrap 5

I'm struggling to create a button that displays a loading message. In my HTML file, I have: <div class="btn-area"> <button id="connectMetamaskBtn" class="btn sp-btn" type="button" ...

Simple method for swapping out an HTML string with image tags solely using JavaScript

In our Ionic 2 App, we are displaying content from a backend API in the form of Questions and Answers. The Answers are generated using summernote, allowing us to render raw HTML in the app. However, we need to replace all instances of img tags in the answe ...

No matter what I attempt, my presentation refuses to align in the center

My slideshow, which is powered by jQuery/JS and involves absolute positioning for each image, is causing me trouble when trying to horizontally center it on the page. No matter what I do, I can't seem to get it right. The challenge is not only getting ...

Is there a way for multiple <select> elements to have identical options in React?

Currently, I have a React component structured like this: export default function ExampleComponent() { return ( <div> <select required name="select1"> <option label=" "></opti ...

What is the best way to increase the padding in a Colorbox modal window?

Is there a way to increase the padding in a Colorbox modal window? I want some extra space between the edges of the modal window and the actual content. I experimented with the innerWidth and innerHeight properties, but unfortunately, I didn't notice ...

Tips for creating spacing between an image and a button when utilizing the routerLink feature in CSS

To enhance the user interface, I've utilized a routerLink with an image to navigate back to the home page, and a button to direct users to add a new customer. Now, I am aiming to create some space between these elements. Previously, I used "& ...

Leveraging the power of PHP sessions within jQuery/HTML/Ajax

Following a successful login attempt, my PHP script initializes a session in the following manner: session_set_cookie_params(1800,'/','www.mydomain.com',true); session_start(); header("location:mainpage.html"); Now, I have ...

What is the best way to implement a new search input for my datatable while also enabling the searchHighlight feature?

I'm attempting to implement a search bar for my datatables. I need to hide the default search engine that comes with datatables, so I added a script that I found in a forum. However, when I try to run it in my code, it doesn't work and displays a ...

using angularjs to dynamically apply css styles

Below is the input I have: The HTML code is shown below: <input type="number" ng-class="{negative: amount < 0}" ng-model="amount"/> This is the corresponding CSS code: .negative { color: red; } If the amount is positive, no specif ...

Floating with Bootstrap Utility

Have you ever wondered about the proper usage of bootstrap float utility? Check out this example: <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <div class=" ...

Guide to positioning a link on the right side of a navigation bar

I am trying to achieve a specific layout using Bootstrap. I want to align the logout button to the right-hand side and have three modules (contact us, about epm, and modules) centered on the page. Can someone guide me on how to achieve this using Bootstr ...

Strategies for smoothly navigating the page to a specific div every time

Currently, I am working on a form that requires submitting multiple child forms. To enhance user experience, I have incorporated jQuery functionality to display a message at the top of the page upon each submission. Now, my goal is to implement a feature w ...

What is the best way to retrieve the value of a submitted button in a jQuery form submission?

I am facing an issue with my HTML code. Here is the structure: <form method="post" id="IssueForm" action="wh_sir_insert.php"> <input name='id[]' type='checkbox' class="selectable" value='$col[8]' /> <inpu ...

Troubleshooting Issues with Integrating Bootstrap Carousel

UPDATE: When I attempt to click on either the left or right icons, it unexpectedly scrolls me down to the bottom of the page. It seems to be related to the #truespeed aspect. The carousel functions perfectly when it is on a standalone page but causes issue ...

Receiving the result as well as encountering undefined initially during AJAX request

I have a dropdown menu, and when a user selects an option, an AJAX call is made to retrieve and display data based on the selected value. If the dropdown value is 2, it triggers the AJAX request. However, I am encountering two issues: https://i.sstatic.n ...

Opting for a CSS framework instead of building custom CSS from scratch

In my quest to achieve the best CSS practices on my website, I initially relied on my own custom CSS. However, I then discovered the option of using CSS frameworks like Bootstrap or Foundation Zurb. While I believed that using a framework alone would meet ...

jQuery registers the enter event, but does not proceed to trigger the enter action

Hey there, I've been experimenting with jQuery to capture the enter event. Something peculiar is happening though - after pressing enter in the text area, an alert pops up but the text gets entered only after that. Despite trying various solutions, I ...