using CSS to create page division

My webpage is structured into three sections: left, center, and right. Elements that should be displayed in the center have the attribute class="center", while those intended for the right are marked with class="right". However, I am encountering an issue where the layout does not render as expected when running the following code:

<div id="center">
  <div>Hello world </div>
  <div><label>Name</label> <input type="text" name="fnam" class="fields" id="fn" /></div>
</div>

Instead of displaying inline, the output appears as:

   Hello
   world
   Name 
   field (text input)

An unexpected behavior is observed where elements are forced onto a new line if there is any space between them. This issue is consistent for elements under both class="center" and class="right". The CSS styling for these classes is defined as follows:

#right{
  position : absolute;
  right:500px;
  margin-top :-75px;
  width : 160px;
  padding : 3px;

}
#center {
  margin-top:10px;
  width: 130px;
  margin-left: 500px;
}

Answer №1

leftSide

{ width:24%; min-height:300px; border:1px solid #000; float:left; }

middleSection

{ width:50%; float:left; min-height:300px; border:1px solid #000; margin-left:10px; }

rightPanel

{ width:24%; float:left; min-height:300px; border:1px solid #000; margin-left:10px; }

<div id="leftSide"></div>
<div id="middleSection"></div>
<div id="rightPanel"></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

Does inserting an href into a table link cause additional spacing to appear?

Currently tackling a website project and encountering an issue where inserting an href link into a table causes the text to shift forward. Seeking insights on why this is occurring. <!DOCTYPE html> <head> <title>Title</title> < ...

Elevate your website with a mesmerizing CSS effect: watch

I am trying to achieve a CSS3 effect where an image slides up when hovered over, similar to this. I came across this example, but I do not want to use the box's background property. <div class="box"> <img src=image/image.jpg> & ...

What could be causing the issue with executing the command "npm run sass"?

I encountered an error when attempting to run the command "npm run sass". Could someone please review the screenshot I took for reference? View npm run sass screenshot ...

Having trouble getting StencilJS Bottomsheet to work properly? Looking for a way to smoothly slide up your content?

I've been working on creating a Bottomsheet in Stencil, but I'm facing an issue where it shows up suddenly when activated. My goal is to display the overlay when the active property is set, and then smoothly slide up the content. Below is my comp ...

The <span> tag creating a surprise gap following a word

Using Angular4, I've come across an odd issue where one of my span elements is adding an extra space to the end of words like this: https://i.stack.imgur.com/H4TD7.png The only CSS properties that are set include font-family, -webkit-font-smoothing, ...

Tips for aligning social media icons above an image on a webpage

Image I am seeking advice on how to position three social media icons on top of each picture, aligned to the left but in line with the image. Below is the code snippet I have been working on: body { background-color: #1a1a1a; } #downloadbutton{ width: ...

Unable to create a button within a table that spans 100% height of the column

Hello, I'm encountering an issue with a table while using bootstrap. The table contains columns, some filled with data and some empty. Each column needs to have a button, even the empty ones. However, I am struggling to get the buttons in the columns ...

How can I convert a PHP class into inline CSS styles?

While exploring MailChimp's css inliner at , I found myself curious if there are any available classes that can achieve the same result. It would be convenient to have this functionality directly in my email code without relying on MailChimp. I am es ...

Loading CSS files conditionally in Angular2's index.html

Currently, my index.html page features a dark theme: <base href="/"> <html> <head> <title>XXX</title> </head> <body> <link rel="stylesheet" type="text/css" href="assets/dark_room.css"> <my-app ...

Encountering issues loading background image with Reactjs and Webpack

I've encountered an issue while trying to load a background image in my React project from a custom CSS file. I am currently using Webpack 4. .bgimage { height: 100vh; background: url('../images/header.jpg'); } Unfortunately, the image ...

Exploring the world of jQuery waypoints and the art of modifying

This is only the second question I'm asking here, so please be gentle! I've been experimenting with jQuery waypoints to dynamically show and hide a border under my navigation menu based on scroll position. For instance, when the sticky nav is ov ...

Ways to display items at the bottom using flex

When you type a new message in a chat bot or messenger window, it typically appears at the bottom of the chat history while everything else moves up. This way, the user can always see the latest message without the chat window growing endlessly as older me ...

Experiencing excessive CPU usage while utilizing a progress bar in Angular

Whenever I try to load a page with 2 progress bars, my CPU usage goes through the roof... I decided to investigate and found that once I removed them, the site's speed improved significantly. Here's a code snippet of one of the progress bars: ...

Animating elements within Firefox can sometimes cause adjacent elements to shift positions

Currently, I am working on a single-page website that utilizes keyboard-controlled scrolling. To achieve the desired scroll effect, I have developed a JavaScript function that animates divs. Here is the JavaScript code: var current_page = "#first"; func ...

I am facing an issue where my Javascript hide and show function is not working properly when clicked. Despite not giving

I am currently working on a Javascript onClick function to toggle the visibility of content in a lengthy table. I initially set part of the table's class to display: "none" and added a button to show the hidden content when clicked. However, nothing i ...

How can you insert text onto a page with restricted space?

As I work on my web page, I find myself restricted by a character limit of 10,000. This limitation is proving to be quite challenging for me. The tabs on the page I am editing are divided with div ID, and all my writing already takes up 80% of the charact ...

Non-responsive behavior triggered by a button click event (JavaScript)

Help needed with displaying results on the same page for an online calculator I'm creating. Why are the results not showing up as expected? I want users to input 4 pieces of information, have the logic executed, and then display the answers below th ...

How can you prevent <div>s from overlapping when using the float property?

I am facing a CSS challenge that I haven't been able to resolve yet: My goal is to create a webpage layout with two divs side-by-side in a row (using float:left; and float:right;) and then a third div below them. The issue arises when the top row (de ...

The proper display of the background color requires the use of position:absolute

While crafting a website using HTML and CSS3, I've run into a little trouble with nesting divs within each other and utilizing absolute positioning. Incorporating position:absolute allows me to specify the background color of the div and manage the el ...

Is there a way to stop jQuery from crashing during rapid transitions in a Bootstrap 4 accordion?

Check out my code snippet here: https://jsfiddle.net/aaz15/dLnrsfty/ I am working on a project where I want to customize the behavior of Bootstrap components in a unique way, diverging from the standard documentation () by creating two separate divisions ...