What is the best way to apply the background color from a parent div to a span element?

Is there a way to make the background color of the Reset Password section span the full width of the outer div and header section?

html:

<div class="forgot-inner">
            <!--Forgot-header-->
                    <div class="forgot-header">
                        <div class="header">
                        <span>Reset Password</p>
                        </div>
                    </div>
</div>

css:

        .forgot-inner {
        max-width: 331px;
        margin: 39px auto;
        padding: 13px 24px;
        background: #fff;
        text-align: center;
        border: 1px solid #aaa;
        border-radius: 4px;
        box-shadow: 2px 11px 31px 2px rgba(0,0,0,0.2);
    }

    .forgot-inner .forgot-header .header{
        border-bottom:1px solid #aaa;
        text-align:left;
        background-color:#edefed;
        width:100% !important;
        font-size: 14px;
        font-weight: bold;
    }    

Check out the preview here

Answer №1

 .forgot-inner {
        max-width: 331px;
        margin: 39px auto;
        padding: 13px 24px;
        background: #fff;
        text-align: center;
        border: 1px solid #aaa;
        border-radius: 4px;
        box-shadow: 2px 11px 31px 2px rgba(0,0,0,0.2);
    }

    .forgot-inner .forgot-header .header{
        border-bottom:1px solid #aaa;
        text-align:left;
       
        width:100% !important;
        font-size: 14px;
        font-weight: bold;
    }  

 .forgot-inner .forgot-header .header span{background-color:#edefed;}
<div class="forgot-inner">
            <!--Forgot-header-->
                    <div class="forgot-header">
                        <div class="header">
                        <span>Reset Password</p>
                        </div>
                    </div>
</div>

       

Answer №2

Give this a shot:

padding: 15px 20px;

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

Ways to showcase JSON data with jQuery

My code displays movie data from a JSON variable and populates it on a dropdown list based on the selected city. I aim to include show timings along with other details from the JSON content. The code snippet is as follows: $(document).ready(function() ...

Finding the closest button using Selenium in Python

I am attempting to click on the "Delete Comment" button once I have identified a comment that contains the specific hashtag, husky, which is a clickable link. Since there are multiple "Delete Comment" buttons on the page, my approach is to locate the comm ...

The resize function fails to trigger when it is required

Struggling to get this code working properly. If the window width is greater than 800, I want 6 images with a red background. If the window width is less than 800, I want 4 images with a blue background. I need this functionality to work both on r ...

What is the best way to create a border for the active class nav-item in Bootstrap 4?

I am facing an issue with changing styles in the nav-item. I have created a separate style sheet and added the necessary code to make the changes. Surprisingly, the changes are reflecting well in Internet Explorer but not in Firefox. Can anyone guide me on ...

"Customizing the color of the arrow in Bootstrap tooltips

Trying to customize tooltips in twitter-bootstrap, I set the template option of the tooltip with inline styles to achieve red tooltips instead of the default black color: $(document).ready(function(){ options = { container: 'body&ap ...

Avoid changing the styling of the parent element when hovering over it

I am working on a comment box that allows for nested comments and is structured in the following way: <article class="comment"> Level 1 comment <article class="comment"> Level 2 comment </article> <article class="comment"& ...

What is the best way to center align all elements using a wrapper in CSS grid?

I am working on designing a layout that looks like this: https://i.sstatic.net/jAaXL.jpg I have set the wrapper as a class and aim to center everything on the screen. Aside from the wrapper, I also want to make the text and form equal sizes. Here is th ...

Initiate the React application with the given external parameters

I have created a React app that is embedded within a webpage and needs to start with specific parameters obtained from the page. Currently, I am passing these parameters in the index.HTML file within a div element. The issue arises when these parameters ar ...

ReactJS how to prevent accordion from collapsing automatically

My custom accordion layout for the features needed in the site I am building is not working well with Jquery. How can I modify it to collapse properly? Specifically, I want it so that when I open number 2, number 1 will automatically close. I've trie ...

Maintaining the placement of dialogue boxes within the screenplay

I am facing an issue with displaying dialog boxes within a form. When I assign a div inside the form to a dialog, it gets moved to the bottom of the script and is no longer contained within the form element. As a result, I am unable to submit the values. ...

My webpage is displaying the background image, but it is appearing behind all the other elements on the page

I've run into an issue where my background is showing up, but it's appearing behind my divs instead of alongside the content as I want. I can't seem to get it to work properly. I believe this part of my CSS code is causing the problem: body ...

What is the reason for JavaScript consistently returning the initial value as the result?

My current issue involves customizing Joomla article content using a module. I am attempting to hide a div until a user clicks on an input, such as a radio button labeled Test1. Once Test1 is selected, another hidden field within the div should display the ...

exploring the network of connections

This is what the HTML structure of the webpage looks like: <body> <form> <input type='file'/> </form> <div id='list'> <div>value here<input id='delete' type='button'/>< ...

Guide to making a button in jQuery that triggers a function with arguments

I've been working on creating a button in jQuery with an onClick event that calls a function and passes some parameters. Here's what I have tried so far: let userArray = []; userArray['recipient_name'] = recipient_name.value; userArray[ ...

The search results in ajax live search are present, but unfortunately they are not displaying on

I am currently working on a code for an ajax live search feature and need some help with getting results to display $(document).ready(function() { $("#search").keyup(function() { var query = $(this).val(); if (query != "" && query.leng ...

Create a responsive design for a webpage that adjusts font size based on the dynamic type settings in iOS

Is there a way to ensure that my website's font size dynamically adjusts for iOS users? For example, if a user changes the font size in their iPhone settings (Settings > General > Accessibility > Larger Text), I want the webpage font size to ...

The button will continue to be enabled even if the textfield is empty

I have a task to implement a feature on a webpage where the submit button should remain disabled until all values are entered in the textbox. However, I am facing an issue where the submit button is already active when the page loads. .directive('pas ...

Embedding complex JSON information into an HTML dropdown menu

Here is a JSON string that I am working with: { "electronics": { "cameras": [ "sony", "nikon", "canon" ], "TV": "none", "laptop": [ "hp", "apple", "sony" ] }, "home": { "furniture": [ ...

Tips on determining the type of DOM element for CSS Selector adjustment

In this case, $self is not returning the expected result and I am getting "undefined". To adjust the CSS selector to correctly target the desired element, I need to determine which element type I am dealing with. Is it the "ul", "li", or "a" element? Whil ...

It is impossible for tailwind to overflow while attempting to adjust the menu to the screen size

Here is the full code snippet: https://jsfiddle.net/3Lapnszc/1/ I am attempting to adjust the left navigation menu on the screen. <main class="flex flex-grow w-full h-screen"> <aside class="w-80 h-screen bg-gray shadow-md w-full hidden sm: ...