Having trouble getting CSS styles to work on buttons?

I have implemented the CSS below:

/* HEADER STYLES */
.header {
top: 0;
right: 0;
left: 0;
bottom: 90%;
position: fixed;
padding: 20px;
background-color: #404040;
font-family: 'Lobster', cursive;
font-size: 30px;
}

#fundme {
padding-left: 2%;
font-size: 40px;
float: left;
color: white;
text-decoration: none;
}

.header_buttons {
color: #fff;
background: #00cc66;
border-radius: 8px;
text-align: center;
margin: 5px;
padding: 10px;
}

.hb-4,
.hb-5 {
background: #00cc66;
float: right;
}

.logout {
color: #fff;
text-decoration: none;
background: #00cc66;
padding: 6px 6px 6px 10px;
border-radius: 8px;
display: inline-block;
margin: 5px;
float: right;
font-size: 30px;
}
/* END OF HEADER STYLES */

and the setup on two different pages:

Page One

<div class="header"><a id="fundme" href="https://fund.me">fund.me</a>
    <form method="post" action="">
        <input type="button" name="profile" class="hb-4 header_buttons" value="Profile" />
        <input type="submit" name="logout" class="hb-5 header_buttons" value="Log Out" />
    </form>
</div> 

<div class="container">
the content will appear here
<?php echo "<h4 class='alert'>" . $response . "</h4>"; ?>
</div>

</body>

Page Two

<div class="header"><a id="fundme" href="https://fund.me">fund.me</a>
    <div class="hb-4 header_buttons"><a href="https://fund.me/signup.php">Sign Up</a></div>
    <div class="hb-5 header_buttons"><a href="https://fund.me/login.php">Log In</a></div>
</div> 

<div class="container">
    <form method="post" action="">
        <h1 class="credential_form">Sign Up</h1>
        <input type="text" name="fullname" class="credential_form" id="fullname" placeholder="Full Name" /><br /><br />
        <input type="text" name="email" class="credential_form" id="email" placeholder="Email" /><br /><br />
        <input type="password" name="password" class="credential_form" id="password" placeholder="Password" /><br /><br />
        <input type="submit" name="submit" class="credential_submit" value="Submit" /><br /><br />
    </form>
    <?php if(isset($response)) echo "<h4 class='alert'>" . $response . "</h4>"; ?>
</div>  

</body>

The styling of the buttons in the header is inconsistent between the two pages. Even though they use the same class, one page has buttons and the other links. It seems strange that this would affect the styling. Any ideas why they don't match?

Answer №1

Utilizing the identical class across various elements, such as input[type=submit], input[type=button], and divs containing a tags.

Due to each element having unique default styles, it is necessary to modify your CSS in order to reset or override these defaults.

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

Preventing the page from refreshing when submitting a form

I'm trying to implement a form with a checkbox that functions as a toggle switch. Here's the code I have so far: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style ...

Obtaining the HTML content of a div element that has been retrieved through an AJAX request to a PHP script

My challenge is to fetch a dropdown menu from a server and then manipulate it using jQuery after loading. Although everything loads correctly, I am unable to interact with the dropdown items because they were dynamically added post AJAX response instead of ...

Create a mobile-friendly version of the website that retains all the functionality and features of the desktop

Currently, I am in the process of optimizing my website for mobile devices. However, creating a separate subdomain and folder for a new mobile version is proving to be a challenge since it was not originally requested. How can I ensure that the website ap ...

IIS Configuration and Web Management

Our team is currently working on addressing vulnerability issues on our website, specifically a Cross Site Scripting threat identified during Vulnerability Testing. We have added four lines of code to the web.config file in order to mitigate this issue. ...

Tips for programmatically choosing dropdown menus in Angular 5

Trying to set up a dropdown select option in Angular 5 that dynamically changes based on the backend's input. https://i.sstatic.net/8cgsh.png Keep in mind that both select boxes are identical, only the options inside them vary. selector.html <h ...

Placing divs of varying heights in a circular formation with a specific radius

Recently, I've been attempting to generate a multitude of divs (referred to as bars) and position them in a way that forms a circle in the center. To clarify, here's an example where all bars share the same width and height. Check out the JSFi ...

"Placing a three.js scene within a table: A step-by-step

Is there a way to insert a three.js scene into an HTML table? Specifically, to display a cube in the first column. I attempted the following code, but it was unsuccessful: <body bgcolor="#E6E6FA"> <table style="position:relative; width:100%; bord ...

I am struggling to find a recurring element within a BeautifulSoup object

The challenge that is currently plaguing me is absolutely driving me up the wall. I am attempting to extract some text from the Pro Football Reference website. The specific data I require can be found within a td element labeled as qb hurries situated in ...

Solving the issue of .css being blocked due to MIME type while building tailwind is a common problem faced by

https://i.stack.imgur.com/nrDgJ.png While working on my tailwind CSS project, I ran npm run build. However, upon opening the built index.html file, I noticed that the CSS file was not loading properly. How can I resolve this issue? I am unsure of what st ...

Click the div to fold it

I would like the div to fold down when clicked on and then fold back up when clicked again. Here is my jQuery code: $(".fold_reply").click(function() { if ($('.reply').css('display') === 'none') { $(".reply").sh ...

Comparing input size attribute to div width attribute

I have a situation in my html page where I need an input component and a div component to be the same width. The input has a size attribute of 30, but using the style attribute with "width: 30ch" or "width: 30em" for the div doesn't seem to work as ex ...

Applying CSS onmousemove does not function properly in conjunction with Bootstrap framework

Currently, I have a code snippet that enables an absolutely positioned box to follow the movement of the mouse cursor: $(document).mousemove( function(e) { $(".wordbox").css({ top: "calc(" + e.pageY + "px - 0.8em)", left: e.pageX }) ...

Exploring the Interactive Possibilities of CSS3 with Background Tiles

I'm struggling to implement a flip effect where the content of a div changes, but I can't seem to prevent the text from disappearing after a few seconds. I've tried using backface-visibility:hidden with no luck! HTML <div class="cards" ...

html pagination on website

I am currently displaying my products in rows, however the code I'm using is presenting them in columns instead. I have implemented a datatable pagination feature, but I'm struggling to understand how to properly use it on my website. Can someone ...

Manipulate image position with touchmove event using CSS3 transformations on an iPad

Looking to adjust the position of an image on my iPad3, but running into some difficulties. The movement isn't as smooth as desired and seems to lag behind the gestures being made. This is what I have so far (a 3MB base64 image) <img src="data:i ...

What is the best way to showcase the output of a Perl script on a webpage

I recently came across a resource discussing the process of executing a perl script from a webpage. What is the best way to run a perl script from a webpage? However, I am facing a situation where the script I have takes more than 30 seconds to run and d ...

Create a list of items that are enclosed within a parent element

My menu is generated from a php query and the output is as follows: #ultra-menu { width: 92%; background-color: rgba(255, 255, 255, 0.90); position: absolute; left: 0px; right: 0px; margin: auto; border-radius: 35px; max-height: 300px; ...

Storing Django HTML input array data from _POST variables

Currently in the process of transitioning a website from PHP (Codeigniter) to Django, as I believe it will be a great learning experience. Most issues have been manageable so far, but I am encountering some difficulty with this particular one. In PHP, I c ...

What is the best way to select the element where a user has clicked using JavaScript?

Referencing a previous question on Stack Overflow, the goal is to track user clicks in a Firefox browser using JavaScript. The provided JavaScript code almost achieves this: var DocElements = document.getElementsByTagName('*');for(var i = 0; i & ...

Limiting the character input in ion-textarea within Ionic 2: A step-by-step guide

In my Ionic 2 application, I need to limit user comments to less than 500 characters in a text area. What is the best way to implement this restriction? ...