What could be causing my buttons to malfunction once I've applied padding to the container?

I'm struggling with getting my buttons to appear active. They currently don't have any functionality and lack a hover effect when clicked. Despite my efforts to add effects, nothing seems to change.

After experimenting with the CSS, I've noticed that removing padding from the container sometimes makes the buttons active again. It's inconsistent, though.

As a newbie in website development, this is my first serious attempt at building a site. My previous experience with HTML/CSS was merely for fun, so I'm unsure of what steps to take next.

If you have any suggestions or guidance, please share them. Thank you!

.container {
  padding: 10%;
}

h1 {
  color: #FFEA9F;
  margin: 0 auto 0 auto;
  font-size: 30px;
  letter-spacing: 15px;
  font-family: 'Fira Code', monospace;
  text-align: center;
}

body {
border: 20px;
padding: 20px;
margin: 0 auto 0 auto;
background:linear-gradient(to right,#FFE899,#F48C30);
}

.bottom {
position:fixed;
  bottom: 0;
  width: 100%;
  left: 0;
}


#mainNav {
  font-weight: 100;
  opacity: 0.9;
  font-family: "Nunito", sans-serif;
}

#mainNav .navbar-brand {
  color: #FFEA9F;
}

#mainNav .nav-link {
  color: #FFEA9F;
}

#mainNav .nav-link:hover {
  color: #F48C30;
}

.collapse {
  color: #FFEA9F;
}

.button {
  background-color: #8C1909; 
  border: none;
  color: #FFEA9F;
  /*padding: 10px 25px;*/
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 36px;
  letter-spacing: 5px;
  font-family: 'Fira Code', monospace;
  opacity: 0.8;
  border-radius: 8px;
  box-shadow: 1px 1px #544D4D;
  grid-row-start:1;
}

.button2 {
  background-color: #8C1909; 
  border: none;
  color: #FFEA9F;
  text-align: center;
  display: inline-block;
  font-size: 36px;
  letter-spacing: 5px;
  font-family: 'Fira Code', monospace;
  opacity: 0.8;
  border-radius: 8px;
  box-shadow: 1px 1px #544D4D;
}
<link rel="stylesheet" type="text/css" href="testing2.css">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Fira+Code|Red+Hat+Text&display=swap" rel="stylesheet">


<body>
<nav id="mainNav" class="navbar fixed-top navbar-dark navbar-expand-md" style="background-color: #8C1909">
                <a href="#" class="navbar-brand">HOME</a>
                <button class="navbar-toggler" data-toggle="collapse" data-target="#navLinks" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navLinks">
                    <ul class="navbar-nav">
                        <li class="nav-item">
                            <a href="https://google.com/maps" class="nav-link">MAPS</a>
                        </li>
                        <li class="nav-item">
                            <a href="https://instagram.com/venture.mars" class="nav-link"><i class="fab fa-instagram"></i></a>
                        </li>
                    </ul>
                </div>
            </nav>

<div class="container">
<h1 class="text-center">VENTURE.MARS</h1>
<div class="d-flex justify-content-around align-items-center flex-column flex-md-row" style="height: 200px">
<button class="button" type="submit">CREATE</button>
<button class="button2" type="submit">EXPLORE</button>
</div>

</div>


<div class="bottom">
<img src="background_bottom2.svg">
</div>
</body>

I want to address why the buttons only become active without padding.

Your feedback on other possible issues would be greatly appreciated. While learning Java in the past, I was encouraged to write practical code without resorting to workarounds. Unfortunately, I feel like I've been relying on many workarounds while navigating the world of HTML/CSS on my own.

Answer №1

When working with bootstrap, it's important to reserve navbar-brand for the brand (site name) and not use it for every navbar element. Use .nav-item nav-link for linked navbar items instead.

I'm curious about why you're not structuring your navigation as a ul element with li list items. While this isn't mandatory, it is a common practice.

Take some time to review the navbar documentation as it will provide valuable insights: https://getbootstrap.com/docs/4.0/components/navbar/#brand

Consider styling with an ID for specificity and using pseudo-selectors like a:active and a:visited to ensure consistent colors for visited and active links.

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

Tips for customizing the appearance of a child component using the parent component in Vue.js

I am working on creating a layout using Vuejs and flexbox that includes elements like 'header, sidebar, main-content, sidebar, footer'. I have separated each part of the layout into individual .vue files, such as header.vue and sidebar.vue. In ...

Is there a way to incorporate external HTML files into my webpage?

Looking to update an existing project that currently uses iFrames for loading external HTML files, which in this case are actually part of the same project and not from external sites. However, I've heard that using iFrames for this purpose is general ...

Text aligned at the center of the Y and X axis

I am looking to center my content along the Y axis instead of only on the X axis. To prevent the page from expanding beyond its current size, I have applied the following CSS: html { overflow-y: hidden; overflow-x: hidden } What I want to achieve is havi ...

HTML list style with varying images at the same level in a ul tag

I am working on an Application that generates output with li tags. I am trying to find a way to apply different list-style-image for each li tag of the same level within the ul, while keeping the HTML code as simple as possible. Each li with a class of gre ...

What is the most dependable method for referencing a CSS class through programming?

Within my Sharepoint project, I am dynamically generating controls in the overridden CreateChildControls() method. I am uncertain which approach is more preferable when it comes to referencing the .css file: protected override void CreateChildControls() { ...

Retrieve hyperlinks from webpage

Currently, I am attempting to extract all Netflix movie/show links from this source , along with their respective country names. For example, I aim to retrieve information such as , USA, etc. Despite my efforts so far, the current code retrieves all links ...

Php/JavaScript Error: Identifier Not Found

I've double-checked my code multiple times, but it still doesn't seem to be working properly. When the PHP runs, the browser console displays the following error: Uncaught SyntaxError: Unexpected identifier. I'm not sure if this is a si ...

Selenium tackles identical elements

I have a challenge where I need to create a program that can connect to a website and click on all buttons it finds. The catch is that the buttons are identical in text, link, and CSS properties. Imagine this scenario: <content> <line1> & ...

Enter information to accompany your images in the description box

After browsing through numerous websites tonight, I stumbled upon this code. My goal is to create a photo upload page on Google Drive and set up a dropbox for it. I'm facing an issue where the information inputted into my placeholder box (city and ye ...

Including CSS in an HTML file does not function properly

I've been attempting to import a CSS file into an HTML document, but for some reason it's not working. I have also tried linking the path directly, but that hasn't worked either. <!DOCTYPE html> <html lang="en"> <head> < ...

Is it possible to use AJAX to change the class name of a Font Awesome icon?

I am considering updating the icon after deleting a row. Should I initially include the font awesome icon once in the blade, then remove the class name and add it back with ajax? blade: <div id="status-{{ $country->id }}"> <div id ...

Can search criteria be saved for later use?

I operate a classifieds website that allows users to search through ads. I am contemplating ways to save search criteria so that users can easily reuse them for future searches without having to input the same details over and over again. For instance, th ...

Having difficulty handling text overflow in Angular4 and HTML

I'm facing an issue with displaying a very large text in a table. Despite trying various attributes such as - { text-overflow: clip; } { text-overflow: ellipsis; } { text-overflow: ellipsis-word; } { text-overflow: "---"; } { text-overflow: ellip ...

Difficulty with Jquery's random selection of grid divs

I am working on a grid layout consisting of 9 divs nested in columns of three. The objective is that when the main grid (with ID #left) is clicked, two divs from the middle row (row="1") should have the class .show randomly applied to them. In the column w ...

Encountering difficulties with the mobile display of a Wordpress theme

I am currently working with the megashop theme on WordPress and I have a few queries that need addressing: Is there a way to modify a specific setting exclusively for views smaller than desktop size, without impacting the desktop view? For example, the m ...

Interactive pop-up window featuring a top section, main content, and bottom section

I have a situation where I've created a modal with sticky headers and footers, and the middle section scrolls based on the content. Everything looks great on Desktop, but when viewed on mobile or tablet devices, the footer is stretched and not fully ...

How to toggle between two background colors in a webpage with the click of a button using JavaScript

I need help with a unique website feature. I want to implement a button that cycles between two different background colors (white and black) as well as changes the font color from black to white, and vice versa. My goal is to create a negative version of ...

Creating a responsive website can be achieved by utilizing the ul element or incorporating a div with the CSS

When it comes to responsive design, the choice between utilizing ul and div elements is crucial, especially in regards to the navigation bar. After observing many other developers, I initially opted for ul but soon realized that for certain navigation beh ...

Detecting Pixel Colors Across Multiple Overlapping Canvases

I have a challenge with multiple canvas elements on my webpage. I am trying to retrieve the pixel color of all overlapping canvas elements when they are stacked on top of each other. Let me illustrate with an example below. In this scenario, I am attempt ...

Sharing data between different JavaScript files using Knockout.js

I am working with two JavaScript files named FileA.js and FileB.js. Within FileA.js, there is a function called Reports.CompanySearch.InitGrid: function InitGrid(viewModel, emptyInit) { var columns = [ { name: 'CompanyName', ...