Difficulty in vertical alignment of inline-block elements

Greetings, I am currently working on creating a Resume in HTML. However, I seem to be facing an issue with the inline-block property as the two div elements that should be placed next to each other are not displaying as expected - one of them appears slightly lower than the other.

It appears to be a positioning problem, but I am struggling to identify the exact cause. The divs in question are related to S-boxes and L-boxes styles.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=UTF-8/>
<title>HELLO STRICT</title>
<style>
<!--[if lt IE 9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]-->

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section 
{
    display: block;
} 

h1 {
    color: #906;
    font-family: "Arial Black", Gadget, sans-serif;
    margin-bottom: 0px;
}

h4 {
    margin-bottom: 0px;
    margin-top: 0;  
}

<style> 
time { 
font-style: italic; 
} 

li {
    padding-left: 0px;
    text-indent: 0em;
}

div.S-boxes{
    width: 200px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;
    text-align: right;
}

div.L-boxes {
    width: 500px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;
}

p.inbox {
    margin-top:16px;
}

</style> 
</head>
<body>

<h1>Muhammad Qais</h1>
<div>
  <ul style="list-style: none; padding-left: 0px;">
    <li>Village Sooj Bahadar, P.O. Mandra.
    <li>Tehsil Gujarkhan
    <li>District Rawalpindi
    <li>Pakistan
  </ul>
  <table>
        <tr>
             <td>
                     <img src="Telephone-icon-1-.gif" width="27" height="27">
            </td>
            <td>
                : +92-347-9714967
            </td>
    </tr>

            <tr>
                <td>
                <img src="letter_closed.png" width="27" height="27">
                </td>
                <td>
                : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7aab2afa6aaaaa6a3b6a6aeb4f4f587bea6afa8a8e9a4a8aa">[email protected]</a>
                </td>
            </tr>
  </table>

  </div>

<div class="S-boxes">
            <h4>Objective</h4>
    </div>


 <div class="L-boxes">
        <p class="inbox">Seeking  a challenging opportunity where I will be able to utilize my strong organizational skills, educational background, and ability to work well with people, which will allow me to grow personally and professionally. I am self-motivated and able to work both independently and as a collaborative team member.</p>
</div>


</body>

</html>

Answer №1

Utilizing the CSS property display: inline-block; allows us to showcase two square gray boxes side by side, creating a visually pleasing layout. To ensure proper alignment, especially when dealing with varying content, we include the additional property vertical-align: top.

div.S-boxes{
    width: 200px;
    height: 150px;
    background-color: #E8E8E8;
    display: inline-block;
  vertical-align:top;
    text-align: right;

}

Answer №2

div.S-boxes{
        background-color:#FFF;
        width:20px;
        height:20px;
        display:inline-block;
        border:solid black 1px;
    }

    div.L-boxes{
        background-color:#FFF;
        width:20px;
        height:20px;
        display:inline-block;
        border:solid black 1px;
    }

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

How to conceal sections of a webpage until a child component is successfully loaded with vue

I am currently working on a Single Page Application using Vue. The default layout consists of some HTML in the header, followed by an abstract child component that is injected into the page. Each child component has a loader to display while the data is be ...

Concealing Website Elements with javascript based on class assignments

Despite my hesitation, I have to ask this question after unsuccessful searches in related articles. In my code, I have 7 nav links all with the same class. Due to the length of the HTML, I am looking for a way to hide contents until the link is clicked, an ...

Intriguing flashing dark streak, reminiscent of a boundary within NextJS

I have recently encountered an unexpected issue with my full-width video header that worked perfectly on multiple pages before. Strangely, a thin black line has appeared around the bottom and right side of the div (.header) containing the video, even thoug ...

Error Encountered: Angular JS Throwing Unhandled Injection Error

I am having trouble validating the fields in my index.html and js files. I keep seeing errors, even after trying different versions of angular-route.min.js and angular.js. AngularJs | Basic Login Form <body ng-app="myApp"> ...

Click the "Add to Cart" button to make a purchase

Recently, I've been working on modeling an add to cart feature using jQuery. However, I have encountered a small issue that I'm trying to troubleshoot. When I click the mybtn button, the model displays and functions correctly, but there seems to ...

What is the best way to alter the text color based on certain conditions within a table column using PHP

I am faced with multiple conditions involving if-else statements, where the variable "Remark" changes based on these conditions. if($income==($paid + $deduction)){ $remark="Paid"; } else if($paid > 0){ $remark="Have Due"; } else{ $remark="N ...

Styling an input button to look like a link in Firefox and Internet Explorer

I'm currently using CSS to give my input button the appearance of a link. Here's how I've styled it: input#linkLike { background: none; border: none; cursor: pointer; margin: 0; padding: 0; text-decoration: none; ...

Assistance needed to identify CSS issue specifically in FireFox browser

Working on a new webpage and encountered an issue with the HTML markup: <!DOCTYPE html> <html lang="en> <head> <meta charset="utf-8"> <title>TileTabs</title> <link rel="stylesheet" href="css/style.css" t ...

What is the process for implementing the sticky table header jQuery plugin?

I am looking to implement a sticky header on all tables in my web application, which is built on PHP. As the amount of data continues to grow, search results are fetching more records that may not be visible. I am primarily a PHP programmer and do not have ...

Adding a scroll bar to a fixed container: tips and tricks

I am looking to implement a scrollbar in a fixed container for the cart products. The goal is to enable easy navigation through a large number of products added to the cart by scrolling within the container. Below is the HTML code snippet representing the ...

How can you verify a phone number input?

I have a phone number field in my form that needs validation. The conditions are that the numbers may be 8 digits or 10 digits long, otherwise an error message should be displayed. Is this code snippet correct? <input class="form-control" name="phone_n ...

What is the process for closing the side menu by clicking on the dark area?

I created a basic side navigation menu. When you resize the window to a smaller size, a red square will appear. If you click on this red square, the menu will open. The menu opens correctly, but I want it to close when I click on the dark area instead of ...

Exploring the ID search feature in JavaScript

I'm facing an issue with implementing a search feature in my project. Here is the HTML snippet: HTML: <input type="text" id="search"> <video src="smth.mp4" id="firstvid"> <video src="smth2.m ...

Position the text in the exact center of an HTML element using absolute positioning

Hey there! I am currently working on a website and I'm trying to create a simple delete button that can be used throughout the site. However, I'm having trouble getting it positioned correctly... Here's what I have so far: <button id="c ...

Having trouble loading @font-face fonts

I am experiencing an issue where my downloaded fonts are not showing up in Chrome. I am utilizing scss which gets compiled to css using gulp. If I directly visit http://project-name.localhost/data/fnt/Shermlock.ttf I can successfully download the font. ...

Create a design where the logo seems to be suspended from the navigation bar using bootstrap

My goal is to achieve a navigation bar similar to the one shown in this image: Using Bootstrap 3, the code below is what I have implemented for my navigation: <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <di ...

When the Navbar div is set to Position:fixed, it generates empty space on the page

I'm facing the issue of unwanted white space in the center of the page below the Navigation Bar. Despite numerous attempts to remove it, I haven't been successful. Below is the HTML code snippet: html: <!DOCTYPE html> <html> <h ...

Are there ways to incorporate extra icons into NavMenu in Blazor 8?

I am exploring ways to incorporate extra icons into the NavMenu.razor component of my Blazor version 8 application. In the earlier version, Blazor 7, there was an iconset setup located in wwwroot/css/, which allowed me to include additional icons simply by ...

Determining when a checkbox changes state using HTML and JavaScript

My main objective is to display divX2 when the checkbox for x2 is checked, either by directly clicking on x2 or by clicking on the "Check All" checkbox. The functionality works as intended when the checkbox for x2 is clicked, but it fails to work when the ...

Parallax Effect Slows Down When Scrolling In Web Page

Currently in the process of creating a website with a scrolling parallax effect using Stellar.js on the header and three other sections. However, I'm experiencing lag when scrolling, especially at the top of the page. I've attempted to reduce la ...