Align content at the center of header with a colored background

I recently came across a Bootstrap template that features a transparent navbar and a stunning background image. I am utilizing bootstrap-vue, which simplifies the process with elements like <b-container> serving as shortcuts for standard Bootstrap structures:

<!DOCTYPE html>
<html class="no-js"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <title>Home</title>
    <link rel="stylesheet" href="/site/themes/theme/css/theme.css">
</head>


<body class="flexible-layout">

<div id="app">
    <header style="background-image: url(/site/themes/theme/img/covers/cover-18.jpg)">
        <b-container>
            <div class="component-nav">
                <b-navbar type="dark" variant="dark" class="bg-transparent" fixed="top">
                    <b-navbar-nav>
                        <b-navbar-brand href="/" tag="h1" class="mb-0 logo">Hallowelt.io</b-navbar-brand>
                        <b-nav-item href="/">Home</b-nav-item>
                        <b-nav-item href="/about">About</b-nav-item>

                    </b-navbar-nav>
                </b-navbar>
            </div>


        </b-container>

        <b-container>
            <b-card>
                Test
            </b-card>
        </b-container>
    </header>
    <b-container class="content">
        <main role="main" class="container mt-4">
            <div class="hero">
                <b-jumbotron header="Test" lead="Test">
                    <p>Dies ist ein <strong>test</strong></p>

                </b-jumbotron>
            </div>
            <p>Dies ist ein Test</p>


        </main>
    </b-container>
    <footer class="pt-4">
        <div class="text-center py-3">© 2019
        </div>
    </footer>


</div>

<script src="/site/themes/theme/js/theme.js"></script>

</body>

</html>

This is a snippet of my custom CSS:

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
}

body {
  font-family: "Helvetica Neue", sans-serif;
  font-weight: lighter;
}

header {
  width: 100%;
  height: 75vh;
  background-size: cover;
}

.navbar {
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
  min-height: 75px;
  margin-bottom: 20px;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.15);
  font-weight: normal;
  font-size: large;
  -webkit-transition: all .3s ease 0s;
  transition: all .3s ease 0s;
}

.navbar.bg-transparent{
  background-color: #343a40 !important;
  opacity: 0.6;
  filter: alpha(opacity=50) !important;
}

.navbar a {
  vertical-align: middle;
}

Currently, I would like to enhance the <header> with additional content such as a slider or a card element.

One approach could involve adding a padding rule directly to the <header> container:

header .container {
  padding-top: 100px;
}

However, I am unsure if this method aligns with best practices.

Thus, my query is: What is a proper way to incorporate elements like cards and jumbotrons within the <header> section?

Answer №1

Similar to any other section, you can include the element in the html code and then apply styling in the css file.

Answer №2

To style your card, simply assign a class name to it. Then utilize CSS selectors to locate your class and apply the desired styling. Alternatively, you can make use of bootstrap-vue properties for a b-card and customize it using those.

Explore more on how to customize cards with Bootstrap-Vue here

Instead of...

<b-card>
 Test
</b-card>

consider using the properties provided in the link above...

<b-card
 title="Card Title"
 img-src="https://picsum.photos/600/300/?image=25"
 img-alt="Image"
 img-top
 tag="article"
 style="max-width: 20rem;"
 class="mb-2">
<b-card-text>
  Some quick example text to build on the card title and make up the bulk of the card's content.
</b-card-text>

<b-button href="#" variant="primary">Go somewhere</b-button>

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

Button placement that feels out of place

I'm looking to style an input-group with a form input and submit button using Bootstrap 5. Here's my current code: .card { margin: auto; width: 50%; padding: 10px; opacity: 0.9!important; top: 250px; } <div class="card-header"> ...

Hovering over the top menu items in AngularJS will reveal dropdown submenus that will remain visible even when moving the cursor

I am facing an issue where my top menu has links that display a dropdown of additional menu items upon hovering. I have attempted to use onmouseover and onmouseleave events to control the visibility of the sub menu. However, I have encountered a problem ...

The functions domElement.getClientWidth() and domElement.getClientHeight() are returning a value of 0

When trying to extract the size of a GWT element with a specific CssClass using standard methods, I am faced with the issue that it returns 0; Canvas canvas = Canvas.createIfSupported(); if(canvas == null){ /*alert code*/ } Element ...

Choosing a checkbox by considering the checkbox value, especially in cases where the checkbox and its label are separate elements

My goal is to click on the checkbox located next to the label "Print Method 1". Take a look at how the element appears here Below is the HTML code for reference: <div class="texter"> <div class="checkbox"/> ...

Tips for changing a fullscreen HTML5 video appearance

I discovered a way to change the appearance of a regular video element using this CSS code: transform: rotate(9deg) !important; But, when I try to make the video fullscreen, the user-agent CSS rules seem to automatically take control: https://i.sstatic. ...

In order to check a checkbox, you need to ensure that the scrolling div has been scrolled to the very

I have a situation where I need to ensure that a user has scrolled to the bottom of a disclaimer before they can acknowledge it by checking a checkbox. Our legal department requires this extra step for compliance reasons. Here is an example of how the mark ...

What steps can be taken to resolve the error message "AttributeError: 'WebElement' object does not have the attribute 'find_element_class_name'?"

try: main = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, "main")) ) articles = main.find_elements_by_tag_name("article") for article in articles: header = article.find_element_c ...

Is it possible to achieve a seamless interaction by employing two buttons that trigger onclick events to alternately

I have a specific goal in mind: I want to create two buttons (left and right) with interactive cursors. The left button should initially have a cursor of "not-allowed" on hover, indicating that it cannot be clicked at the beginning. When the right button ...

How can I create a static navigation bar and sidebar using Bootstrap 4?

Currently, I am utilizing HTML, Javascript, Bootstrap, and CSS to develop a fixed navbar and sidebar for our system. My objective is to ensure that the navbar and sidebar remain fixed even when users scroll down the page, while also maintaining responsiven ...

Displaying Fullcalendar data exclusively for the currently logged-in user

In my project, I am utilizing Fullcalendar and Spring framework. The event data from my SQL database is structured into columns: id, doctor_id, patient_id, start, and end. Currently, all events are being displayed regardless of the user logged in, but I w ...

Validating phone numbers with regular expressions in Java

I recently started learning Java and Regex, and I'm currently facing a challenge with phone number validations. The task at hand is to create simple phone number validations. I already have an input field in my HTML code that has the attribute type=" ...

Using PHP variables in CSS styling

Let me explain the situation. In my index.php file, I have a class called 'rectangles' which includes properties for color and size. I defined a variable named $rectangle($rectangle=new rectangles('red',25);). Additionally, I include ...

How come Bootstrap is displaying my icon on a separate line from the text?

I'm facing a layout issue with my Bootstrap grid. When I try to add an icon to a column, it ends up appearing below the text instead of beside it. Can anyone help me identify what's causing this problem? So far, I've attempted using spans, ...

The dynamic combination of jCarousel, jQuery Accordion, and fade in effects

Take a look at this link www.aboud-creative.com/demos/mckinley3. You'll find a jQuery Accordion with jCarousel inside the "Developments" section. I have implemented a standard fadeIn function for the logo, accordion, and a stag on the bottom right to ...

tips for creating a mobile-friendly responsive button

I have been scouring the internet for a solution to this issue. Essentially, I am trying to position the button on the right side in desktop view. Here is an example: chrome view However, when the site is resized or viewed on mobile devices, the button sh ...

PayPal's fast checkout page experiencing a billing problem

I'm experiencing a problem with my paypal express checkout where it won't allow guest-checkout without logging into paypal, despite having the necessary form fields: <input type="hidden" name="SOLUTIONTYPE" value="Sole" /> ...

What is the process for loading fonts in advance?

On my website's index.html I've included the following code: <link rel="preload" href="assets/fonts/Raleway-Black.ttf" as="font" type="font/ttf" crossorigin> <link rel="preload" href="assets/fonts/Raleway-Bold.ttf" as="font" type="font/ ...

pass user identification by using a link using php and MySQL

In my table of items, there is an option for users to delete or restore each item, using a special PHP file called 'delete.php'. print "<td>"; if ($row['deleted'] == 'y') { print "<a href='delete.php?id=2'& ...

Step-by-step guide on generating a canvas with a circle inside whenever a button is pressed

I need help with my code that is supposed to add a new canvas with a circle inside every time a button is clicked. The new canvas should be displayed next to the older ones. Here is my current code: I have two default canvases on the page, and I want new ...

HTML declaration vandalized site

There's a strange bug I've encountered with the use of !DOCTYPE html. Whenever I attempt to implement the HTML5 Doctype, my page ends up looking distorted. It seems like all scripts are not properly closed. However, when I switch to !DOCTYPE ht ...