Having trouble styling my Aside element correctly

I'm having trouble aligning my aside element on the page. It's not lining up properly with the rest of the content and is overlapping into the header area. How can I resolve this issue?

Here's a snapshot of what it currently looks like:

https://i.sstatic.net/btKYn.png

Below is the CSS code I have been using:

* {
    margin:0;
    padding:0;
}

body {
    font-size:1.1em;
    font-family: Arial, Helvetica, sans-serif;
    background-color:darkseagreen;
}

header {
    padding: 1%;
    margin-bottom: 3%;
    text-align: center;
    font-size:2em;
    font-family: Arial, Helvetica, sans-serif;
    text: white;
    background-color: #4EEE94;
}

aside {
    width: 25%;
    padding: 0.5%;
    margin: 0 5px 5px 0;
    background-color: #1C86EE;
    float: right;
    border-radius: 20px;
    position: relative;
    min-height: 100%;
    display: block;
}

#main {
    width: 446px;
    margin-right: 27%;
    padding: 0.5%;
    background-color: #EE6363;
    text: white;
position: relative;
border-radius: 4%;
}

.map {
    padding: 2em;
    margin: 3em auto 3em auto;
    position: relative;
    display: block;
    text-align: center;
    width: 95%;


.image {
    padding: 5%;
    margin: 4em;
    float: left;
    position: relative;
    left: 10px;
    top: 15px;
}
}

div {
    box-shadow: 10px 10px 5px #888888;
    border: 2px solid;
    border-radius: 25px;
}

nav ul li {
    margin-right: 1em;
    display: inline;
    list-style-type: none;
}

nav li a {
    padding: 1em;
    color: white;
    text-decoration: none;
}

nav li a:hover {
    color: yellow;
    text-decoration: underline;
 }

footer {
    margin: 0.5% 27% 0 0;
    border-top: solid thick teal;
    padding: 0.5%;
    background-color: lime;
}

Answer №1

The initial problem with your CSS is that you should remove the extra braces after the .image class.

.image {
padding: 5%;
margin: 4em;
float: left;
position: relative;
left: 10px;
top: 15px;
}
}

Another suggestion is to use either px, %, or em for measurements, instead of mixing them (recommended).

Thirdly, when using an id, follow this format:

<div id="xyz"></div>

Avoid using # in ids like this:

<div id="#xyz"></div>
as # is a css selector.

Lastly, refrain from adding multiple ids like this:

<div id="abc xyz"></div>
, it's not allowed. Instead, use classes like so:
<div class="abc xyz"></div>

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

Is there a way to replicate input data from one website onto a totally separate platform?

I am currently working on a hotel website using the user-friendly WYSIWYG site builder, Wix (yes, I know, don't judge). Like all hotel websites, we need a form for customers to enter their details for reservations and other purposes. However, there&a ...

Switching from ejs format to html

I've been working on a tutorial that uses ejs, but I'm not too familiar with it. I'd like to know how to convert the server.js from using ejs to html. Here's the code snippet: app.set('view-engine', 'ejs') app.use( ...

What caused the submit button to suddenly change colors in such a peculiar manner?

In its natural state, the submit button appears in the default color, lacking any specific style when viewed in Chrome. Once the CSS rule input[type="submit"]{border-radius: 2px;} is applied, the button transforms, suddenly changing color and showing a sh ...

Discovering the closest date among the elements in an array

Currently, I am facing an issue while trying to identify the highest date within an array of objects which have varying dates assigned to each one. The code seems to be functioning well when the dates are above January 1st, 1970, however, any date prior to ...

Tips on transforming JSON output into an array with JavaScript

Looking for a solution to convert a Json response into an array using JavaScript. I currently have the following json response: ["simmakkal madurai","goripalayam madurai"]. I need to transform these results into an array format. Any suggestions on how I ...

The appearance of the Bootstrap button is not displaying correctly

My current button looks like this: https://i.sstatic.net/PyP8v.png As seen in the image above, there is something strange at the back of the button. How can I resolve this issue? I am working on a small project using Django and Bootstrap. Thank you in a ...

Unable to create account using PHP

Every time I attempt to create an account, the data I receive is always problematic. The username must be between 3 and 15 characters I find it frustrating that the account creation never goes through successfully. What baffles me even more is that af ...

Issues with HTML5 tag <animate> in Internet Explorer 11

After getting the hang of some HTML basics, I decided to get creative and make an animation. Surprisingly, it works perfectly on my Firefox browser. However, when I tested it on IE 11, it failed to play the animation as expected. Everything is displayed bu ...

Firefox is unable to display SWF files

My code snippet: <div id="sw" style="cursor:pointer" > <object id="swfobj" type="application/x-shockwave-flash"> </object> The JavaScript part: function openfile(filePath) { $("#swfobj").attr("data", filePath); $("#sw ...

Add HTML content dynamically to a layout that is connected to a controller

While I may not have the proper heading for this question, I need to add this piece of HTML dynamically to my layout and attach its click events with a controller. <div id="subscriber1" class="participant-video-list"> <div class="participant- ...

How can I customize the dropdown list arrow to match my own design?

Is there a simple way to substitute the standard arrow in the dropdown menu with a custom arrow image? ...

Tips on utilizing Blazorise's numeric edit group with grouping functionality

I recently attempted to utilize the numeric edit group separating attribute in Blazorise but encountered issues. According to the documentation, it should be possible to use this feature, however, my attempts were unsuccessful. I would greatly appreciate ...

I am looking to dynamically add and remove an active link on my sidebar using JavaScript

Looking to create a dynamic website with interactive features like adding and removing active links upon clicking, and smooth transitioning between sections using JavaScript. Feel free to skip over the SVG code. HTML source code <div class="s ...

Attempting to insert a square-shaped div within a larger square-shaped div and enable it to be moved around by dragging

Imagine this scenario: I have a button and a large div. When the button is clicked, the code adds a new div inside the larger one. However, the new div is not draggable because I didn't implement the necessary code. I'm also trying to figure out ...

Tips for automatically closing one element when another is clicked

My goal is to create a menu that displays when I click on a link, and if another menu is already open, it should close before displaying the new one. Essentially, I want to achieve an accordion menu where only one menu is open at a time. However, despite m ...

Add a variety of icons to every item in a list using HTML

Is there a way to display multiple icons on the left side of each element, with the option to have none or many? If so, could you please guide me in the right direction. <header> <nav> <ul> <a href="http://localhost:4000 ...

Sending JSON data from the primary window to the secondary window in Electron - A step-by-step guide

I am currently working with a set of 3 files. index.html: ... <a href="#" onclick="fetch(function(data) {console.log(data); subWindow(data)})">subWindow</a> ... The fetch() function retrieves a callback in JSON format. subWindows.js: let m ...

Tips for properly aligning an image within an owl carousel

Currently, I am attempting to center a small image within the owl carousel. While I have managed to center it when it's active and in the center, I'm encountering issues when the item no longer carries the "center" class. You can access Owlcarou ...

Transferring Data from Python Script to Browser (with an xserver running on a Linux system)

Looking for suggestions on how to efficiently transfer data from a Python script to a web browser. The Python script, as well as the browser, are operating under an xServer environment in Linux (specifically Raspbian on Raspberry Pi). The script is respon ...

The text in the Bootstrap 4 card spills over the card-text boundary

I've encountered an issue when trying to insert text into a card-text paragraph. Here's what happens: https://i.sstatic.net/CWGh2.png I've been attempting to resolve the problem without success. I'm completely stumped on how to fix it ...