show all the elements in a single row

My goal is to have two elements displayed in a single line. I tried implementing what I thought would work perfectly, but unfortunately, it's not quite right. Here's the issue:

div#inline{
    padding: 0;
    margin:0;
    display: inline-block;
    height: 40px;
    background-color: blue;
    width: 100%;
    margin-left: 15px;
    margin-top: 10px;
}

input[id="Prod_name"]{
width: 90%;
border-radius: 5px;
height: 30px;
border: 1px solid;
margin: auto;
}

label#label{
float:right;
padding-right: 40px;
}

p#session{
padding-left: 20px;
font-weight: bold;
color: #fff;
line-height:28px;
}

input[id="list_ord"]{
    padding: 0;
    margin: 0;
    float: right;
    width: 5%;
    padding-right: 20px; 
}
  <div id='inline'>
  <p>Menu Item</p>
  <label id='label' for='list_ord'>List Order</label>
  <input type='text' id='list_ord' name='list_ord' value=''>
  </div>

I'm trying to get the list order label, text, and menu item on the same line using both inline and display-inline properties. What am I missing?

Answer №1

div#inline{
    padding: 0;
    margin:0;
    display: inline-block;
    height: 40px;
    background-color: blue;
    width: 100%;
    margin-left: 15px;
    margin-top: 10px;
    
    
}

.inline{
  display:inline-block;  
}

input[id="Prod_name"]{
width: 90%;
border-radius: 5px;
height: 30px;
border: 1px solid;
margin: auto;
}

label#label{
float:right;
padding-right: 40px;

}

p#session{
padding-left: 20px;
font-weight: bold;
color: #fff;
line-height:28px;
    
}

input[id="list_ord"]{
    padding: 0;
    margin: 0;
    float: right;
    width: 5%;
    padding-right: 20px;
    top: 5px;
}
<div id='inline'>
  <p class='inline' style='display:inline-block;'>Menu Item</p>
  <label id='label' for='list_ord'>List Order</label>
  <input type='text' id='list_ord' name='list_ord' value=''>
  </div>

You must also set the paragraph element containing the text, Menu Item, to be display:inline-block;.

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

What is the best way to include a maximum height in my ScrollToBottom element?

I am currently attempting to limit the maximum height of my component as adding user messages causes it to expand and stretch the whole page. However, I have been unsuccessful in setting a maxHeight property for the component. I am utilizing ScrollToBottom ...

I am struggling to find the right way to center those images

https://i.sstatic.net/aRkvl.jpg Hello everyone, I'm currently attempting to set up the main content of the homepage resembling the image provided, but I'm encountering some challenges. Every approach I take seems to cause the image to overflow ...

"Utilizing Box elements, implementing linear gradients, styling with CSS, and

Currently, I am working on a project that involves using react JS and I am trying to find a solution for implementing linear gradient in multiple boxes. Specifically, I want to achieve the effect of having three identical boxes lined up next to each other. ...

When an HTML table utilizes both rowspan and colspan attributes, it may encounter issues with being overlapped by the

I'm working on a straightforward table that showcases the properties of a data element. Each row will represent an element from the AJAX response in a list format. The table is designed with "rowspan" and "colspan" to expand specific cells. However, ...

Browsing the website through http://localhost instead of file:// while utilizing node.js

I am currently in the process of familiarizing myself with node.js. Everything appears to be running smoothly when I access the site from file:///C:/.../myfolder/index.html. The jquery and bootstrap files are located in the directories myfolder/css/ and m ...

Guide to creating a PHP script for interfacing with a MySQL database

Right now, I have just finished learning HTML and I am attempting to write PHP scripts for connecting to MySQL. However, the information on websites such as Google is confusing because they do not specifically outline how to connect using PHP only. Could ...

Alert Div from Bootstrap fails to appear during the second ajax request if the first ajax request is canceled

I've implemented a dismissible alert in my HTML file that starts off hidden. Here's the code snippet: <div class="alert alert-dismissible" role="alert" id="msgdiv" style="margin-bottom:5px;display: none;"> <button type="button" clas ...

The width setting for the Facebook Page Plugin is not taking effect

I'm implementing the Facebook Page Plugin but facing an issue. Despite setting the width to 500, it remains stuck at 280px. <div id="facebook-feed" style="text-align: center"> <div class="fb-page zdepth-1" data-width="400" data-h ...

Update the select tag to display as radio buttons

Hey there, I've got a webpage where users can rate different systems. I've written a JavaScript function to dynamically add and remove systems for evaluation. The only issue is that I have to manually change the radio button names to prevent th ...

What is the best way to horizontally align Font Awesome icons in the center?

In my table, I have a Font Awesome icon that I'm trying to align left with text and center the icons. I attempted to center the <i> element but it didn't work as expected: Here is the HTML code: <td><i class="icon-ok"></i&g ...

Inserting closing </tr> elements into HTML snippets during a loop

I am looking to populate an HTML table with elements from an array. Here is the array: var tags_arr = [1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19]; To create the table, I insert <tr> tags every 4th iteration like so: var checks = "<table bord ...

Designing a straightforward thumbs-up icon

Hey there! I'm currently working on a blog application and trying to set up a simple like button for each post identified by its primary key (pk). However, I encountered an error along the way. The error message I received is "NoReverseMatch at /sing ...

Is there a way to ensure that the div of my template spans 100% in width and height?

I'm attempting to make my div 100% in size but I am having trouble achieving it. Here is my code: <template> <div> <Navbar/> <Calendar/> </div> </template> <script setup> import Calendar from &apos ...

Tips for incorporating the numerous values of a one-to-many relationship into an HTML template using Django

I am facing an issue with a one-to-many relationship in my Django project. Here is how it is structured: class Listing(models.Model): title = models.CharField(max_length=60) class Images(models.Model): listing = models.ForeignKey(Listing, on_delet ...

Guide on extracting HTML content from JSON and displaying it in a UIWebView (utilizing Swift 3.0)

Can anyone guide me on how to use JSON2HTML to parse HTML data from JSON and display it in an UIWebView using Swift 3.0? Your help is much appreciated! This is what I have attempted so far: let jsfile1 = try!String(contentsOfFile: Bundle.main.path(forRes ...

What is the best way to ensure a logo image is properly scaled to fit its parent container using Bootstrap 4

I am struggling with my navigation bar, which consists of a simple logo and a few links. The issue I am facing is that the logo image is too tall for the parent container, which has a fixed height. It's clear that the logo with the gray background e ...

Tips for executing parallax designs, similar to the techniques used on the

Currently, I am in the process of creating a website that utilizes parallax scrolling. Here is a brief overview of what I have accomplished thus far. I decided to use the skrollr plugin to achieve the desired parallax effect. Through this plugin, I was abl ...

Footer alignment issue when using react-full-page is causing it to not lineup at the bottom of the page

Currently, I have integrated the react-full-page package into my project. However, after adding the Footer to the routes, I noticed that the footer is only visible in the second section of the page and does not appear at the bottom as expected. If you wan ...

Switching the root directory for the Next.js application caused a meltdown on the production server, while the development server and local build remained unaffected

TL;DR I modified my base path from "/" to "custom-subpath" and encountered CSS missing on the production server despite it working well on my local server. Please forgive me, as explaining this issue may be challenging due to my limite ...

Avoid wrapping elements

Is there a foolproof method or best practice to prevent an HTMLElement from wrapping? Specifically, I'm referring to elements with relative positioning. One possible solution could be using absolute elements and adjusting their left position based on ...