Optimal approach for vertically aligning elements in CSS

I'm looking to arrange my header ('Sail away today with Starboard Rentals.') and link buttons on top of each other. I want the navigation buttons to be positioned below the h1 on the lower half of the 'home-jumbo' div. What's the best way to separate these two elements and place the nav buttons underneath?

I attempted to position the jumbo-btns separately, but my CSS doesn't seem to be working.

View Site Header Image

return (
        <div className="home-div">
            <div className="home-jumbo">
                <h1 className="jumbo-header">
                    Sail away today with StarboardRentals.
                </h1>
                <div className="jumbo-btns">
                    <Link to="/rent" className="jumbo-btn">
                        Rent
                    </Link>
                    <Link to="/about" className="jumbo-btn">
                        About us 
                    </Link>
                </div>
            </div>
            <div className="card-deck">
                <div className="boat-cards">
                    <BoatCard addToCart={addToCart} />
                </div>
            </div>
        </div>
    )
.home-jumbo {
    width: 80%;
    height: 75%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
    box-shadow: 0px 1px 3px 0px;
    border-radius: 1%;
    background-image: url("/public/img/home-bg.jpg");
    background-size: cover;
}

.home-div {
    margin-top: 3%;
    margin-bottom: 10%;
    height: 100vh;
    width: 100vw;
}


.jumbo-btns {
  
}

Answer №1

Your CSS appears to be well-written; simply include flex-direction: column; in the .home-jumbo class.

You may want to consider removing the jumbo-btns container, although this decision is ultimately at your discretion.

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

Getting checkboxes from an HTML form in Django: A comprehensive guide

I am trying to create a form that displays checkboxes for each item in a list. Here is the structure of my form: <form action="/test"> <ul style="font-size:30px"> {% for d in Dlist %} <li type="none"><input typ ...

Guide to selecting and clicking multiple elements with a specific class using jQuery

On my html page, I have the following elements: $(".pv-profile-section__card-action-bar").length 3 I want to click on all of these elements instead of just the first one. Currently, I am achieving this with the code: $(".pv-profile-section__card-action- ...

What is the best way to fix the Syntax error that reads "Unexpected token (1:13)"?

I can't seem to figure out why my code keeps showing errors in the browser. I'm still new to coding and learning slowly, with help from knowledgeable individuals on stackoverflow :) Card 1.jsx Syntax error:() Unexpected token (1:13) > 1 | i ...

How can we store both a single JSON error and an array of errors in the same variable using Javascript?

My server sends me JSON with a list of errors. If there is more than one error, it looks like this: { "ErrorFuncional": [ { "ErrorCode": "1020", "ErrorReason": "xxxx", "ErrorPosition": "xxxx", "O ...

Error: Invariant violation - App component did not return anything in the render method

I am facing an issue while attempting to render a component based on the promise returned from AsyncStorage. The error message I receive is: Error: Invariant Violation: App(...): No content was returned from the render method. This typically indicates ...

The information seems to not be getting transferred to the req.body variables from the HTML form

Within my server-side settings using knex and express, I have defined the following function: // POST: Create new users app.post('/add-user', (req, res) => { const {firstName, lastName, emailAdd, gender, dob, password} = req.body; cons ...

"Clicking on the hamburger menu causes the webpage to reset its scroll

I recently integrated a mobile hamburger menu into my website, which is primarily built around a single page. However, I noticed that whenever I open the menu, it automatically scrolls to the top of the page regardless of where you were previously scrollin ...

Grid system that is responsive, while also maintaining a fixed column width

My problem seems simple, but I can't find an easy solution. What I need is to create a grid with fixed widths and a fixed distance between each column. Each column should be 400px wide, and as the browser window is resized, the grid should adjust by ...

Create a custom sorting pipe in Angular 10 that allows for a specific value hierarchy to be passed, without adhering

I am attempting to sort a list of form objects in angular 10 using a custom pipe. The goal is to order them based on a specific property with the following priority: [{VALID: 1}, {INVALID: 2}, {DISABLED: 3}]. I have defined this order as an argument for th ...

Using the ng-repeat directive along with the string replace expression allows for dynamically

Struggling to find a way to remove a substring within an angular expression while using the ng-repeat directive. The controller resides in an external JavaScript file, and here is the corresponding HTML code snippet. function myController($scope, $http ...

Encountered a surprise JSON ERROR during installation of a React Native package

I encountered an issue while trying to add the firebase package to my React Native project. npm i --save firebase When running the above command, I received the following error: npm ERR! Unexpected end of JSON input while parsing near '...5L/bQQbhWxI ...

How to center an image vertically inside a link using CSS

My goal is to vertically align an image inside an anchor element using the following code: <ul class="thumbnails"> <li class="span2"> <a href="#" class="thumbnail"> <img src="http://www.forodefotos.com/attachme ...

Tips on retrieving the status code from a jQuery AJAX request

I am trying to figure out how to retrieve the ajax status code in jQuery. Here is the ajax block I am currently working with: $.ajax{ type: "GET", url: "keyword_mapping.html", data:"ajax=yes&sf="+status_flag, success: callback.success ...

What causes the error "Failed to load SWC binary for win32/x64" when using getStaticProps?

Encountering an issue while using getStaticProps() in a Next.js application, resulting in the following error when running the app: warn - Attempted to load @next/swc-win32-x64-gnu, but it was not installed warn - Attempted to load @next/swc-win32-x64-ms ...

Error in Node and Express: Unable to access route

Currently, I am in the process of developing an Express application and running into some obstacles with routing. While my '/' route is functioning perfectly fine, other routes are not working as expected. Despite researching similar questions fr ...

Switching out a traditional class component with a functional component within a hook to deduce properties from T

One challenge is to subtract props from T within the withHookFn function using a function instead of a class as successfully done in the withHook function. The code contains comments explaining this issue. Dive into the code for more insights. import Reac ...

Ensuring the node array is easily accessible within the view

I am currently working on building a simple messaging system using express/nodejs. Although I have successfully implemented the feature to send messages to all users, I now want to enable users to have private 1-to-1 conversations. My aim is straightforwa ...

Looking to display an element right away, like a loading spinner, in Vue? If nextTick isn't doing the trick, here's what you can try

Imagine having a Vue component stored in a .vue file with a data member called isLoading: false. The template includes: <div v-show="isLoading" id="hey" ref="hey">Loading...</div> <button @click="loadIt()">Load it</button> Along w ...

How can I iterate through a directory containing files and extract the exported JavaScript object from each one?

In my current project using nodejs / nextjs, I have file system access and a folder containing multiple React files: content - blog-post-1.jsx - blog-post-2.jsx - blog-post-3.jsx The task at hand is to extract the frontmatter from each file. My init ...

Add the retrieved information from an API fetch request to the state variable

Below is a function that runs another function inside a forEach loop: async populateSystemData(id) { const response = await fetch('https://localhost:44389/api/systemlist/GetSystems/' + id); const data = await response.json(); const r ...