Buttons are not aligned with the rest of the row's height

I'm currently working on designing an upload layout that consists of a container with a row inside. Within the row, there are two buttons (each containing input elements) and one h3. For some reason, I am having difficulty getting them to align at the same height consistently. Here is the snippet of code showcasing this issue:

HTML

<div id="mi-wrap">
    <h1>Title</h1>

    <div id="main-wrap">
        <div id="inner-wrap">
            <div id="wide-bar">
                <button id="upload-button">
                <input type="file" id="upload" value="PDF"/>
                </button>
                <h3 id="file-preview"><i class="fa fa-arrow-left"></i>Upload your file here</h3>
                <button id="send-button" type="submit" name="search-button">
                </button>
            </div>
        </div>
    </div>
</div>

CSS:

#mi-wrap {
  width:100%;
  margin:0 auto 0;
  height:200px;
}

#main-wrap {
    background-color:blue;
    width:90%;
    margin:0 auto 0;
    height:100%;
}

#inner-wrap {
  width:100%;
  height:100%;
  display:table;
}

#wide-bar {
    height:60px;
}

#wide-bar button, #wide-bar h3 {
  background-color: green;
  height:60px;
  display:inline-block;
}

#wide-bar button {
  width:25px;
}

#wide-bar button input {
  display:none;
}

#wide-bar h3 {
  width:50%;
}

This code snippet may not be exact but it visually represents the challenge I am facing in my project. You can also check out the corresponding jsFiddle link here.

Answer №1

To achieve the desired layout, consider adding another display property such as inline-block in conjunction with vertical-align

#wide-bar h3 {
  width:50%;
  display: inline-block;
  vertical-align:top;
}

Check out the functioning solution here:

https://jsfiddle.net/56g67abc/2/

Answer №2

give this method a shot

#wide-bar button, #wide-bar h3 {
    background-color: purple;
    border: 2px solid black;
    /*display: block;*/ /*Replace this line with comments*/
    float: right;/*Include this line*/
    height: 50px;
    margin: 5px;
    padding: 10px;
}

Answer №3

Here is a solution that should work:

#wide-bar {
    vertical-align: middle;
    max-height:60px;
    display:table;
}

#wide-bar button, #wide-bar h3 {
  margin:0;
  padding:0;
  background-color: green;
  display:table-cell
}

#wide-bar button {
  width:25px;
  height: 60px;
}

Answer №4

Update your CSS with the following changes:

#wide-bar {
    height: 60px;
}

#wide-bar button, #wide-bar h3 {
    margin: 0;
    padding: 0;
    background-color: green;
    height: 60px;
    display: inline-block;
    float: left;
}

Check out the JSFiddle demo here!

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

The lower division remains static when the browser window is resized

Why does the div with class .lower not move to the bottom of the page when the screen is resized? Could this be because of its CSS property position:absolute;? Check out the code snippet here. #lower { width: 100%; position: absolute; bot ...

Is there a way to modify just the homepage url of the logo on a WordPress website using the OceanWP theme?

My website, abc.com, is set up with Angular for the homepage and WordPress for the blogs. The WordPress site is located in a subfolder within abc.com. You can see the file structure in the image below. I am now looking to change only the homepage link on ...

Adding design to distinct element after clicking a button

Struggling with a JS/Jquery issue on my portfolio website, I admit that I am still just an average programmer. My portfolio website has five buttons, each representing a different project. For each project, there is a corresponding text description and an ...

Creating an HTML Canvas using an AngularJS template

I am facing an issue with rendering html elements on a canvas using html2canvas JS. I am utilizing AngularJS for data binding on the html page, but unfortunately, the dynamic data is not showing up on the canvas generated from these html elements. For inst ...

Elements on the left side are not properly aligned

I've successfully coded the head banner and news containers below the header. However, I'm facing an issue with my left menus: Instead of aligning properly with the header and news containers, they are overlapping them. Here is the HTML Code: ...

Is there a way to trigger a click event on an href using asp code behind?

Is there a way to programmatically trigger a click event on the href "shipping_question_ID_product_received_as_ordered_link" from the code behind of an ASP form? This href triggers a complex function in jquery when clicked by the user. I need to simulate ...

The HTML button triggers a function to execute on a different webpage when clicked

I'm facing a straightforward issue that I can't seem to figure out due to my limited experience with Angular and web development. The problem revolves around two components, namely home and dashboard. In the home.component.html file, there's ...

Chrome reload causing page to automatically scroll to bottom on my website

Could really use some assistance in solving this problem as I am completely stumped. I've noticed an issue on one of my websites when pages are reloaded. Every now and then (not consistently, which adds to the confusion), upon refreshing a page, it ...

Using a `right: 0` value will not be effective when using absolute positioning

Currently, I am in the process of developing a website utilizing Bootstrap 3.3.6. After going through a tutorial on how to create a responsive banner slider, I found this resource helpful: http://www.jqueryscript.net/slider/Full-Width-Responsive-Carousel- ...

What is the best way to retrieve all the information from a JSON file using a foreach loop in Laravel?

My Laravel Controller public function index() { $get=Storage::disk('public')>get('Philippines.json'); $json = json_decode($get, true); return view('BarangayFolder.index')>with('json& ...

Every time you attempt to download in Vue, you are met with the familiar sight

Encountering a peculiar issue while attempting to download an apk file using a Vue.js website: Referring to How to download a locally stored file in VueJS, I am trying to download a local file with this command: <a href="../../app-debug.apk" download= ...

PyScript <script type="py-editor"> Issue: SharedArrayBuffer cannot be used in an insecure environment

I am currently using PyScript to execute a basic Python script within my HTML file in order to show a pandas DataFrame. However, upon loading the page in the browser and attempting to run the code block by clicking the run button, I encounter an error rela ...

Several validation checks - logic malfunction

I have implemented a validation feature for passwords on a form, but I suspect there may be a logic error in my code that I haven't caught yet (blame it on the coffee machine!). Take a look at the JavaScript below: <script type="text/javascript"& ...

What is the best way to position a div at the bottom of a web page?

I have a question that may seem basic, but I've been struggling to find a solution. Despite searching for answers, none of the suggestions I've come across have worked for me. My application has two main containers - a header and a content div. T ...

Generate an HTML table from a CSV file with no success in finding a working solution

I came across a solution here However, I am having trouble implementing it. It seems like there might be a basic issue. Can someone provide some advice? This is the snippet of PHP code on my server: $ cat table.php <?php echo "<html><body&g ...

Centering a button within a table-cell through movement

I'm facing an issue with aligning a button placed inside a table cell. The table setup is as follows: <b-table v-if="rows.length" :thead-tr-class="'bug-report-thead'" :tbody-tr-class="'bug-report-tbody& ...

What is the solution to fixing the error message "SyntaxError: missing ) after argument list" in JavaScript?

I wrote some code in HTML/JavaScript/PHP, and in the 3rd echo statement, I added a button that calls the deleteAttribute() function when clicked. However, I encountered an error at the 3rd echo statement with (type = "button"): "Uncaug ...

Arrange text boxes within a form and table to be in alignment with the labels

https://i.stack.imgur.com/MFQnD.png I'm facing difficulty aligning checkboxes with labels within a form and a table. Despite reviewing various answers and websites, I am still unable to achieve the desired alignment. How to consistently align check ...

Cover the entire screen with numerous DIV elements

Situation: I am currently tackling a web design project that involves filling the entire screen with 60px x 60px DIVs. These DIVs act as tiles on a virtual wall, each changing color randomly when hovered over. Issue: The challenge arises when the monitor ...

Having Trouble with the Bootstrap Responsive Menu Button Not Working

I'm struggling with the Bootstrap menu I created, as it's not collapsing or animating. Everything seems to be working fine except for the button that isn't functioning. <nav class="navbar navbar-expand-lg navbar-light bg-dark alb ...