The issue with displaying inline block is that the divs are not appearing side by side on the

Two of my div elements, namely form-panel and data-panel, are currently not aligned on the same line. How can I use display:inline-block to align them in a single line? Please review the code provided below. I have already used display:inline-block on both panels, but their alignment remains offset.

var data=[
{"name":"Test Task#1","date":"12/01/2012","assigned":"John Doe"},
{"name":"Test Task#2","date":"12/02/2012","assigned":"John Doe"},
{"name":"Test Task#3","date":"12/03/2012","assigned":"John Doe"},
{"name":"Test Task#4","date":"12/04/2012","assigned":"John Doe"},
{"name":"Test Task#5","date":"12/05/2012","assigned":"John Doe"},
{"name":"Test Task#6","date":"12/06/2012","assigned":"John Doe"},
{"name":"Test Task#7","date":"12/07/2012","assigned":"John Doe"}
];
function load() { 
var tableData="";
var stage=$("#stage");
$.each(data,function(i){
          stage.prepend('<tr><td>  ' + data[i].name + '</td>'+'<td> ' + data[i].date+ '</td>'+'<td style="width:30px;"></td><td> ' + data[i].assigned+ '</td></tr>');
  });
}
$( document ).ready(function() {
$( "#sfrm" ).on( "submit", function( event ) {
event.preventDefault();
showValues();
 
});
function showValues() {
    var str = $( "form" ).serializeArray();
    var dateArr = str[1].value.split('-');
   dateArr.push(dateArr.shift());
   var date=dateArr.join('/')
$( "#stage" ).prepend( '<tr><td>  ' + str[0].value + '</td>'+'<td> ' + date + '</td>'+'<td style="width:30px;"></td><td> ' + str[2].value + '</td></tr>');
  }
});
body{
margin: 0px;
padding: 0px;
font-family: arial;
}
.background_panel{
width: 1024px;
margin: 0px auto;
background-color: #e2e2e2;
padding: 10px;
margin-top: 85px;
overflow: auto;
}
h1{
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}
.main_panel{
  background-color: #ffffff;
  padding: 10px;
  position: relative;
}
input[type="text"],input[type="date"]{
height: 40px;
font-size: 16px;
width: 90%;
border: 1px solid #dedede;
background-color: #ececec;
border-radius: 6px;
}
input[type="submit"]{
background-color: #434343;
border: 1px solid #ececec;
border-radius: 6px;
padding: 10px;
color: #fff;
font-size: 18px;
}

.content{
position: relative;
}
.form_panel{
width: 47%;
padding: 10px;
display: inline-block;
background-color: white;
}
.data_panel{
background-color: white;
display: inline-block;
width: 48%;
padding: 10px;
}
.clear{
clear: left;
}
.main_header{
  border: 1px solid #f0f0f0;
  min-height: 120px;
  background-color: #f0f0f0;
  z-index: 1;
  padding: 10px;
}
hr{
  width: 3px;
  height: 370px;
  position: absolute;
  left: 490px;
  background-color: #f0f0f0;
  border: 1px solid #f0f0f0;
  border-radius: 5px;
  top: -12px;
}
table{
border-collapse: collapse;
border: 3px solid #dedede;
border-radius: 6px;
}
td{
padding: 9px;
}

tr:nth-child(even){
background-color: #cecece;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
    <meta name="author" content="Spino Tutorials" />
<title>Task Tracker</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
</head>
<body onload="load()">

<div class="background_panel">
<div class="main_header">
<h1>Task Tracker</h1>
<span>v2.0</span>
</div>
<div style="vertical-align:top">
<div class="form_panel">
<h3>Create a Task</h3>
<form id="sfrm">
Task Name<br>
<input type="text" name="task" ><br><br>
Date<br>
<input type="date" name="date"><br><br>
Assigned To<br>

<input type="text" name="assigned" ><br><br>
<input type="submit" id="target" value="Submit">
</form>
</div>
<div class="data_panel">
<h3>Existing Tasks</h3>
<table id="stage" style="table-layout: fixed; max-height: 350px;"></table>
</div>
</div>
 <div class="clear">
 
 </div>
</div>
</body>
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/functions.js"></script>
</html>

Answer №1

Instead of applying vertical-align: top to the parent div, add it to both individual divs.

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

Mixing CSS layers

Applying this particular css: .addProblemClass{ width:300px; height:300px; /*width:25%; height:40%;*/ border:solid 1px #000000; margin: 5px; background-color:#FFFFFF; padding:5px; opacity:0.9;/*For chrome and mozilla*/ ...

Launching numerous websites in separate browser tabs using the window.open function

I have a code snippet that opens one tab pointing to a website, but I need it to open two. For example: www.google.com and www.yahoo.com Currently, it only works with one site in the code: window.open("https://www.google.com"); but not when bot ...

Establish and define the global variable "Protractor"

In order to pass a string value from the function editPage.CreateEntity();, you can use that value in multiple test cases by assigning it to the variable entityName. You are able to retrieve the value by setting up the test case as follows: fit('Te ...

myObject loop not functioning properly in Internet Explorer version 10

Could someone please point out what is wrong with this code snippet? HTML: <div id="res"></div> Javascript: var myObject = { "a" : { src : "someimagepath_a.png" }, "b" : { src : "someimagepath_b.png" }, }; va ...

JavaScript in Internet Explorer is showing an error message stating that it is unable to access the property '0' of an undefined or null

JavaScript Code function update() { var newAmt = 0; var newtable = document.getElementById("tbl"); for ( var i = 0; i < newtable.rows.length; i++) { innerTable = newtable.rows[i].cells[0].childNodes[0]; if ( (innerT ...

Creating a repository of essential functions in AngularJSDiscover the steps to set up a

I am looking to create a set of reusable functions in AngularJS for CRUD operations that can be used across multiple entities in my project. I have already set up a factory using $resource for server communication, which looks like this: Model File: var ...

"Encountering a connectivity problem with Apollo server's GraphQL

I am facing a networking issue or possibly a bug in GraphQL(Apollo-Server-Express). I have tried various solutions but to no avail. When sending a query, everything seems perfect - values checked and request showing correct content with a 200 status code. ...

Next.JS CSS modules are experiencing issues with functionality

Organizing the CSS structure for a project by creating a module of CSS for each component or page can sometimes present challenges. Take a look at the code snippet below: .navbar { display: flex; justify-content: flex-start; align-items: center; pa ...

Can you please explain the distinction between angular.equals and _.isEqual?

Do these two options offer different levels of performance? Which one excels at conducting deep comparisons? I've encountered situations where Angular's equals function fails to detect certain differences. In addition, I've observed that th ...

What is the process for setting a cookie in Next.js from a different backend server?

I have encountered an issue with my Node.js API built using Express.js. The cookie I set works perfectly fine on Postman, but for some reason, it is not functioning properly in Next.js. I set the cookie when a user logs in, but it is not appearing in the b ...

Fixing issues in PHP File Editor

At our web development company, we have created an online file editor and file manager script for our website users to easily manage their files and customize their templates. This script is written in PHP and allows users to edit html, text, php, js, jque ...

I'm looking for a skilled CSS spinner creator. Can anyone recommend one?

Can anyone recommend a good online application for creating CSS spinners? I've been searching and only found one on David Walsh's blog, but it only has one available. Any suggestions? ...

Is there a way to output several lines from a JSON file in print form?

I'm working with HTML code that displays multiple lines from a JSON file, but it only shows one line at a time. How can I modify the code to display all users' information? <!DOCTYPE html> <html> <head> <script> function ...

Issue with EnumDeserializer in jackson-mapper 1.9.12 version

I'm currently working on a scenario where I need to map a String to an enum Object using the Jackson ObjectMapper.readValue(String,Class) API. The issue arises when my JSON string contains a Task Object with an Action enum defined as follows: public ...

Issue with toggling options in q-option-group (Vue3/Quasar) when using @update:model-value

I'm a newcomer to the world of Quasar Framework and Vue.js. I recently tried implementing the q-option-group component in my simple application but encountered an issue where the model-value and @update:model-value did not toggle between options as ex ...

Create JavaScript variable from either HTML or database sources

Hello, I am trying to implement a counter that retrieves its value from a JavaScript file, but I would like to customize it. Below is the JavaScript code: function updateCounter(count) { var divisor = 100; var speed = Math.ceil(count / divisor); ...

Error message in console: AngularJS throws an error saying 'No module found: uiCropper'

Hey there, I'm looking to add an image cropper to my webpage. I came across some code on Codepen, but when I tried using it, the code didn't work and I encountered this error angular.module('app', ['uiCropper']) .controll ...

Using CSS to align a <li> element in the center

Do you have a question? I am trying to center a menu using the <li> tag, and I also have two buttons. .subiectele-zilei { width:100%; padding-left: 25px; overflow:hidden; padding-bottom:8px; background-color:#f5f5f5; margin ...

Serve static assets files based on the route path instead of using absolute paths

Within Express, I have set up the following route: app.get('/story/:username', function(req, res){ res.render('dashboard.ejs'); }); Prior to that, I am serving any static files located in /public: app.use(express.static(__dirname ...

Transferring JSON data using AJAX

I am having trouble sending JSON via AJAX using pure JavaScript. While I can successfully retrieve values back from PHP, I am struggling to retrieve a specific JSON array. var mname = ["john", "mary", "eva"]; var fname = 678; clicked_keyword_test = {"last ...