Challenges with borders within a modal box

I am trying to create some spacing above and below the 'offer' button within my modal. Initially, I attempted to add a 30-pixel border to the bottom of the button, but it doesn't seem to be appearing. The end of the modal aligns directly with the end of the button, resulting in no space between them.

https://i.sstatic.net/f3NTF.png

CSS

.slidecontainer {
  width: 100%;
  padding-left: 20px;
  padding-right: 20px;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 15px;
  border-radius: 5px;
  background: #d3d3d3;
  outline: none;
  opacity: 0.7;
  -webkit-transition: .2s;
  transition: opacity .2s;
}

h2 {
  padding-top: 10px;
  padding-bottom: 10px;
}

#offerButton {
  border-bottom: 30px;
}

#inline {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  padding-bottom: 10px;
}

#text1 {
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

HTML/ANGULAR

<body>
  <div id="text1">
    <h2 class="text-center" id="offer">Offer: <span>${{offerVal}}</span></h2>
    <h2 class="text-center" id="offer">Price: <span>${{price}}</span></h2>
  </div>

  <div class="slidecontainer text-center">
    <input type="range" min={{min}} max={{max}} class="slider" id="myRange" [(ngModel)]="offerVal" name="slider">
  </div>
  <div class="text-center">
    <button class="btn btn-success btn-sm" type="button" id="offerButton" (click)="offer()">  Offer  </button>
  </div>
</body>

Answer №1

To create space between the offer button and the end of the modal, follow these steps:

Add some padding-bottom to the slidecontainer class.

.slidecontainer {
    width: 100%;
    padding: 0 20px 30px 20px;
}

Insert the offer button inside a div where you have applied the slidecontainer class.

<div class="slidecontainer text-center">
    <input type="range" min={{min}} max={{max}} class="slider" id="myRange"
           [(ngModel)]="offerVal" name="slider">
    <div>
        <button class="btn btn-success btn-sm" type="button" id="offerButton"
            (click)="offer()">  Offer
        </button>
    </div>
</div>

Avoid adding border-bottom to the button as it will not fix the spacing issue.

Additionally, remember that each element must have a unique id, so ensure that the id for one of the h2 elements is different from the one with the id offer.

Answer №2

To create space around the offerButton, consider adding margin to its ID instead of using a border-bottom property.

#offerButton {
  margin: 30px;
}
<body>
  <div id="text1">
    <h2 class="text-center" id="offer">Offer: <span>${{offerVal}}</span></h2>
    <h2 class="text-center" id="offer">Price: <span>${{price}}</span></h2>
  </div>

  <div class="slidecontainer text-center">
    <input type="range" min={{min}} max={{max}} class="slider" id="myRange" [(ngModel)]="offerVal" name="slider">
  </div>
  <div class="text-center">
    <button class="btn btn-success btn-sm" type="button" id="offerButton" (click)="offer()">  Offer  </button>
  </div>
</body>

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

Navigating Through Siblings with Http Agility Pack

When it comes to working with the HTML Agility Pack, it's easy to extract descendants and entire tables. However, how can you utilize this tool in a unique situation like the example below? ...Html Code above... <dl> <dt>Location:</dt ...

Accessing JSON data through crawling may trigger an "Invalid access" warning

Currently extracting data, I came across this base URL After inspecting chrome's developer tools - Network tab, I found the following URL: international?Adt=1&Chd=0&ECITY1=HKG&ECITY2=ICN&Fa…019.03.13.&TRIP=RT&W ...

increasing the size of a particular text box above the rest

Just starting out with bootstrap and trying to figure out how to make one text box larger than the others. See my code below: <div class="row"> <div class="col-md-2"> <mat-form-field > <input matInput pla ...

What is the best way to create a variable within this loop that remains constant and does not update?

I'm having some trouble phrasing this question, but I'm working on creating a loop to display dates for a calendar. So far, everything seems to be working well, except for one thing. My goal is to allow users to click on a date within the calenda ...

Steps for aligning items in a column horizontally in Bootstrap 5

After creating a Grid system with only 2 columns, I placed text in the first column and a carousel in the second. Despite setting a custom size for the carousel image, I'm facing difficulty centering it horizontally within the column. .title-sec { ...

Glitch in jQuery causing multiple instances of text being added to a textarea consecut

I created a response system where users can reply to comments by clicking on the reply button. Once clicked, it triggers a function that adds @user at the beginning of their comment: $('#inputField').focus(); $('#inputField').text(&apo ...

Unhook, add at the beginning, and set requirements jQuery

There are two clickable div elements that can switch classes when clicked. If the first one contains "1", it will be given a class of "active". If the second one contains "2", it will have the class "active" while removing the class from the first one. &l ...

`How can I trigger a JavaScript event when the content of an input field is modified?`

Currently, I am working on implementing validation in JavaScript. My goal is to provide the user with an alert whenever they modify the value of an input field. <input type="text" name="onchange" id="onchange" size="35" maxlength="50" /> ...

use python selenium to retrieve text enclosed by two span elements

<li class="page-item active"> <span class="page-link"> "12" <span class="hjhs">(current)</span> </span> </li> After reviewing the code above, my objective is to extr ...

jQuery does not support animations for sliding up or down

I'm struggling to conceal a navigation element once the top of the #preFooter section is scrolled to. In order to make the nav element mobile-friendly, I have designed both the .tab-wrap and .tab-wrap-mobile. To enable these elements to slide away w ...

Utilizing Various jQuery Selectors for Option Values

I'm currently facing a challenge with including extra value selectors in jQuery. My goal is to include option[value="18:00"] so that if option [value="17:00"] is not chosen, it will trigger the function when 18 is selected. Below is the code snippet: ...

Developing an identical design and layout but utilizing a distinct domain name for the company

After being given the task of creating a website identical to an existing one with a different domain name on WordPress, I proposed using the parent HTML source code or cloning it to speed up the project. The client agreed, explaining that starting from sc ...

Is your form complete?

Is there a way to determine if all required fields in the current form are correctly filled in order to disable/enable navigation? Are there any specific properties or JQuery functions that can be used to check for form completion status? ...

Ways to extract metadata from a given URL

Recently, I've delved into the world of JavaScript and I'm looking to extract metadata from a given URL. Whenever a URL is entered into an input field, I want to retrieve its meta data - a simple task in HTML using JavaScript. However, every time ...

invoking a function from an attached HTML file using Angular

How can I invoke a function in Angular using inner HTML? I attempted the following: cellTemplateFunc(cellElement, cellInfo){ var subContainer = document.createElement('div'); subContainer.innerHTML = "<a href='javascript:v ...

Is it possible to modify this code to accept multiple IDs at once?

I'm attempting to create a form in JavaScript where, upon entering the necessary details and clicking submit, the user's email client opens with the information pre-filled for easy sending. However, I am facing challenges as my code involves mult ...

Ways to create distance between two Table Rows in Material-UI TableRow

const useRowStyles = makeStyles({ root: ({ open }) => ({ backgroundColor: open ? "#F5F6FF" : "white", backgroundOrigin: "border-box", spacing: 8, "& > *": { height: "64px", ...

Leverage the power of DOMXPath in combination with the query function

Here is a snippet of HTML code to work with: <ul id="tree"> <li> <a href="">first</a> <ul> <li><a href="">subfirst</a></li> <li><a href=""> ...

Aligning inline form controls with Bootstrap and Syncfusion widgets

I'm facing a challenge aligning the Syncfusion JavaScript widget - a dropdownlist - to be displayed inline with the label. I am using Bootstrap 3. I haven't been successful in achieving a nice alignment, meaning getting the middle of the label p ...

Animate the chosen text via specialized effects

I am trying to implement a show/hide feature for specific text using jQuery. The challenge I am facing is having multiple instances of the same text tag with identical ids. I want to trigger the animation on a particular child element when hovering over it ...