What is the best way to make a button stretch across the entire width of the footer on a mobile device screen?

I'm attempting to make a button located in the right rail column on my test page (in desktop view) expand to fill the entire footer of the page in mobile view.

Below is the CSS and JavaScript code I am currently using:

@media screen and (max-width: 768px) {
    #register_text_container {
        position: fixed;
        bottom: 0px;
    }
}

$(function() { //doc ready
    if (!($.browser == "msie" && $.browser.version < 7)) {
        var target = "#register_text_container", top = $(target).offset().top - parseFloat($(target).css("margin-top").replace(/auto/, 0));
        $(window).scroll(function(event) {
            if (top <= $(this).scrollTop()) {
                $(target).addClass("fixed");
            } else {
                $(target).removeClass("fixed");
            }
        });
    }
});

The JavaScript code belongs to someone else, sourced from stackoverflow, and it has been effective. However, I am struggling to make the button fill the entire page. I attempted using width: 100%, but that did not work.

The container referenced in my CSS code is inaccessible to me as it is part of the CMS and appears as a button.

Upon inspecting the Register button's HTML code to determine what to reference in my CSS file, I found the following:

<div class="entry-page-button-container" id="register_link_container">
<div class="manageable-content" data-container="edit_register_text_container">
<a class="entry-text-link secondary-step step-button" id="register_text_container" href="">Register</a>
</div>
</div>

I have tried targeting each class and ID without success in getting the register button to span the full width of the page.

Any assistance would be greatly appreciated.

Thank you!

Test Page

Answer №1

On the link with the classes

.entry-text-link secondary-step step-button
, there is a width: 250px !important. Change this to width:100% (and remove the unnecessary !important).

Next, include left:0; and right:0; in the element with the class .entry-page-button-container.

These adjustments should ensure proper functionality.

Answer №2

To ensure the button occupies the entire width of its parent container, you can simply set the width of the button element to 100%.

This can be achieved by adding the following style attribute:

<div>
<button style="width: 100%">Click here for a full-width button!</button>
</div>

By doing this, the button will span the full width of its containing div element.

Answer №3

Make sure to delete width : 250px !important from the <a> tag and instead apply it to the fixed element.

width: 100%;
left: 0;
bottom: -10px;

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

Menu only appears with a double click on the label button

Currently, I'm facing an issue where I have to click the label "button" (hamburger menu) twice in order to show the menu for the second time. My belief is that there might be a conflict between CSS and jQuery causing this behavior. The desired funct ...

Is it possible to override the body width setting?

Is it possible to override the width of the body element? For example, consider the following: <body> <table id="table1"> <tr><td></td></tr> </table> <table id="table2"> <tr><td></td>& ...

How do you transform data stored in map to string format?

The main objective is to take a large txt file and replace all words according to the information in a csv file. This process will generate a new txt file as well as a new csv file that shows the frequency of each word. I'm currently struggling with ...

Triangles positioned on the edges of a division element

I am attempting to create a DIV with angled corners, as depicted in the image below: https://i.sstatic.net/1a9LY.png So far, I have successfully implemented the top right corner using a tutorial. Here is the code snippet that accomplishes this: .lifeatb ...

Creating a background color without using the <canvas id> element can be achieved by utilizing CSS properties such as

As a novice in the world of HTML and CSS, I find myself working on creating my website using HTML. Upon inspecting my site, I notice that the default background color is white. Despite trying to change it by using #canvas { background-color: black; } in ...

Creating a circular border around a specific letter: What's the trick?

Can someone guide me on how to create a circular background behind the letter "A" using CSS? Check out the example below: ...

The Array.splice() method in Angular JS may result in undefined elements

Hey there! Currently, I am tackling the task of manipulating my Array by inserting objects at index 0 with the push method and eliminating items using splice. As per my understanding, when you splice an item from an array, it should not result in an &apos ...

Exploring the functionality of inline easing when using the ScrollTo plug-in

Attempting to utilize the ScrollTo plug-in with an easing effect. I prefer not to include the easing plug-in file, as I will only use it once and for a single easing effect. The specific 'easeOutBack' function I aim to implement is: easeOutBac ...

Encountering obstacles with asynchronous requests while attempting to retrieve an Excel file using ajax

I am coding JavaScript for a SharePoint project, focusing on creating a function to retrieve data from an Excel document in a library. While I have successfully implemented the basic functionality, I am facing an issue with large file sizes causing the dat ...

Retrieving ID of an element to be animated with jQuery

I have a sprite image that changes background position when hovered over, and while it's currently working, I'm looking for a more efficient way to achieve this. I need to apply this effect to several images and am exploring ways to avoid duplica ...

Some pages are compatible with JS while others are not... Although, the file can be found in the page source

I have limited knowledge in javascript, so I often find myself copy-pasting code. Currently, I am working on a website that includes a navigation sidebar. I have implemented a script to toggle a class that sets the display property to none. $(document).rea ...

Leverage the geocode callback function results from Google Maps in NodeJS to render a map on the AngularJS 2 component template

Hey there, I'm currently utilizing the Google Maps Node.js client web API and want to showcase a map on my HTML views using AngularJS 2. I have a server export that sends an object to my AngularJS2 client service const googleMapsClient = require(&ap ...

Is it possible for Express in Node.js to handle multiple static folders at once?

Currently, I am working on a project that involves a user uploaded collection of styles, scripts, and images as well as my app's own collection of these resources. They are stored in separate directories on my server. I am wondering if there is a way ...

Having trouble compiling Vue.js for Internet Explorer 11

After seeking help on Stack Overflow and conducting extensive research, I have finally configured my babel.rc file as follows: { "presets": [["env", { "modules": false, "uglify": true, "targets": { "browsers": ["> 1%", "last 2 versi ...

generating a dynamic tree structure with JSON by leveraging a database

It was brought to my attention that I am facing a unique challenge: I am trying to generate a JSON tree using Java/JavaScript with data sourced from a MySQL Database. I have not been able to locate the appropriate documentation for this task Any assistan ...

Navigating nested JSON objects using D3 - A guide

I have a problem in my REACT application where I am trying to implement Mike Bostock's Multi-Series Line Chart using D3 v4. I am reading JSON response with axios and passing it to a component using react-faux-dom, but even though the object seems corr ...

"Step-by-step guide to updating user information in MongoDB with the help of node.js

I have been working on a basic express app with MongoDB integration, allowing users to register, log in, and log out successfully. However, I am facing an issue when attempting to implement the functionality to edit user data. The code runs without any err ...

Improving the Sum of Pairs solution on Codewars

Seeking assistance in optimizing a solution for a problem that has already been identified. However, the existing code is not efficient when dealing with large arrays - view the problem on codeWars : Sum of Pairs Below is the current code snippet: var s ...

Issue with depth perception in a 3D bar graph created with D3.js

I am currently working on a 3D bar chart in D3.js, inspired by the code found here I'm facing an issue where, when the bars are placed close together and the chart is rotated, the perspective/projection/view behaves strangely, causing some values to ...

Executing javascript href using Python in Selenium

Currently, I am attempting to use Selenium in Python to click on a href JavaScript link. The HTML code appears as follows: HTML Example and my goal is to click on javascript:goType(1). This is the approach I have taken: advance_search = browser.find_el ...