Arrangement within a span

I've been refreshing my HTML/CSS skills in preparation for a new job opportunity. The last time I dabbled in HTML was way back in 1999... Needless to say, I've fallen quite behind. As a big fan of the "Space Trader" game on Palm OS, I've taken on the challenge of recreating all the game screens in HTML. However, I'm currently facing a CSS issue that's proving to be quite challenging.

Here's the screen I'm attempting to recreate:

And here is the code snippet:

<div class="screenTitle">
    <h1 class="leftTitle">Bank</h1>
    <span class="titleButtons">
        <input type="button" id="btB" value="B" />
        <input type="button" id="btS" value="S" />
        <input type="button" id="btY" value="Y" />
        <input type="button" id="btW" value="W" />
    </span>
</div>

And here is the corresponding CSS code:

.screenTitle {
    height: 0.7em;
    border-bottom-style: solid;
    border-color: rgb(49,0,156);
    font-size: 40px;
}
.leftTitle {
    margin-top: 0;
    font-size: 0.5em;
    text-align: center;
    color: white;
    padding-left: 0.1em;
    padding-right: 0.1em;
    background-color: rgb(49,0,156);
    float: left;
    border-top-left-radius: 0.3em;
    border-top-right-radius: 0.3em;
    line-height: 1.5em;
    font-weight: bold;
}
.titleButtons {
    float: right;
}

Here is the current result of my efforts

I seem to be struggling with positioning the 4 shortcut buttons properly. Any suggestions or critiques you have will be greatly appreciated.

Thank you so much!

Answer №1

To adjust the position of your buttons vertically, update your CSS with the following code:

.titleButtons input{
   vertical-align:top;
}

Check out the live demonstration here

Answer №2

   .titleButtons input {
    float: right;
    vertical-align:top;
    margin:7px 0 0; /* Adjusted margins */
    }

By adding top margin and removing some left/right margins, the buttons will align better on the bar.

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

Unable to locate template or render function for Vue Draggable Next component

Looking to incorporate Vue Draggable Next into a Vue 3 example page but encountering some challenges. I've attempted to follow the instructions in the repository. However, I ran into issues when importing the Vue Draggable Next component and had to re ...

Ways to animate elements while scrolling in React.js?

I am new to using React.JS and currently working on setting up an E-commerce Store. My goal is to have 5 images stack on top of each other and move together as the user scrolls. I used to achieve this effect in Vanilla JavaScript by adding a window.addEven ...

How come the Google fonts won't display correctly within my HTML document?

After importing some fonts into my CSS file, I noticed that they are not displaying correctly in the design. Below is the code for the imported fonts and CSS linking: https://i.stack.imgur.com/9RQ4u.png The output only shows sans-sarif working properly: ...

Creating a "select all" feature in an HTML multiple select box with jQuery - a step-by-step guide

I'm currently working on an HTML form that includes a multiple select box. I am looking to create a "select all" option within the multiple select box so that when a user clicks on that option, all other options in the select box are automatically sel ...

I'm having trouble with my Typescript file in Vscode - every time I try to edit the css code, all the text turns red. Can someone

Check out this visual representation: [1]: https://i.stack.imgur.com/9yXUJ.png Followed by the corresponding code snippet. export const GlobalStyle = createGlobalStyle` html { height: 100%; } body { background-image: url(${BGImage}); ba ...

"Troubleshooting problems with jQuery accordion collapse and styling using CSS

I'm currently dealing with an issue regarding my accordion design. I have customized the stylesheet using themeroller, but when I collapse one of the sections, the header changes to black instead of reverting back to its original red color. I've ...

Challenges arising from the offset in an overflowing Div

Encountering issues with JQuery Offset when utilized within a div that has a fixed height and overflow. This particular div contains two columns, a main column and a sidebar. The objective is to have one of the sidebar divs scroll within its container unt ...

One way to change the cursor CSS property is by dynamically altering it based on scrolling behavior. This involves modifying the cursor property when scrolling

I'm attempting to adjust the cursor property within an Angular function. The issue I'm facing is that when I begin scrolling the webpage, the cursor changes to a pointer, but when I stop scrolling, it remains as a pointer. I've attempted to ...

Issue with Jquery's dotdotdot.js plugin when handling text containing HTML components is causing malfunction

For my current project, I have incorporated dotdotdot.js to handle text truncation. However, after integrating a rich-text editor (tinymce), some HTML elements like p, a, b, i, etc., have been added to the text. Unfortunately, dotdotdot is now not behaving ...

When sorting items, the page automatically jumps to the top of the screen

I have been working on creating a sortable portfolio using jQuery. One issue I am facing is that every time I click on a filter for the portfolio items, the page automatically scrolls to the top. Is there a way to prevent this from happening? You can vi ...

What could be the reason for my select list not showing up?

Hello fellow developers, I am currently working on creating a dynamic tablerow that allows users to fill in input fields and select options from a list for each cell. While the input fields are functioning properly, I am facing an issue with displaying th ...

Is it possible to style a nested ID with CSS?

Imagine a scenario where you are working within an HTML file that you cannot modify, but you have the ability to only edit the CSS through a stylesheet. Is it possible to target an ID within another ID in the same way you can do with classes? #id1 #id2 {s ...

Introducing the new and improved SweetAlert 2.0, the ultimate solution for

I am currently utilizing SweetAlert2.0, known as "This One" <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> It is functioning properly; however, I would like to display a table, div, or HTML element within this swe ...

The amazing feature known as "CSS3 background-clip"

Seeking a solution for restricting a background image to the text within an h2 element using -webkit-background-clip. Wondering if -moz-background-clip functions in the same way as -webkit-background-clip. As it currently only works in webkit browsers, it ...

Align the central element in the Bootstrap menu between two other elements

My menu layout looks like this : .navbar { box-shadow: 0 5px 15px rgba(0, 0, 0, .15); background: #fff; border: 0; max-height: 73px } .navbar-center>span>a { display: inline-block; position: relative; } #header>.navbar>div:nth-child(2)> ...

Creating a unique URL for a new page in PHP: Step-by-step guide

When not using frameworks, how can we generate a new URL in PHP for a dynamically created page by users? For instance, when a user creates a new account or posts an article, we want to assign a specific URL, such as . I'm curious about how to generate ...

How to Make a Doughnut Chart Using CSS

For a while now, I've been working on filling in 72% of a circle with a hole cut out of the middle. Throughout this process, I have been consulting different resources - like this method for calculating and this one for other aspects. However, I’ve ...

Issue with using variables in nodejs, express, and EJS: Undefined

Having some trouble with EJS here. I am using response.render('agent.html', {name: 'aaaa'});, and in my HTML script, I attempt to access <%= this.name %>. Unfortunately, I keep getting a ReferenceError: aaaa is not defined. Any sugge ...

What is the best way to ensure the image and card maintain the same size ratio in React Bootstrap?

One of the challenges I encountered involved a vertically aligned card group containing a card with an image: https://i.stack.imgur.com/w9Jkf.jpg This is the React code snippet that was causing the issue: import React from 'react'; import { ...

Whenever I select a menu item, my intention is to make all the other main menu options disappear

I've been grappling with this issue for quite some time now. My goal is to hide all other main menus whenever I click on one. For instance, if I click on the Discord menu, I want all other menus to disappear except for the sub-menu. Check out the cod ...