The submit button is getting disrupted by the background image being set

Implement the following CSS code to set a background image on a single-page app (Angular).

.page::before {
  content: '';
  position: absolute;
  background-size: cover;
  width: 100%;
  height: 100%;
  background-image: url("../../assets/weird.png");
  opacity: 0.2;
}
...
/* button */
#submit-button {
  position: center;
  background: #000000;
  border-radius: 5px;
  font-size: 15px;
  padding: 15px 15px 15px 15px;
  margin: -15px 15px 15px 15px;
  color: white
}

Below is the HTML structure for the page:

<div class="page">
<h1 class="sunrise">Asheville Ipsum</h1>
<h2 class="sunrise">Asheville Infused Lorem Ipusm Generator</h2>
  <h3 class="sunrise">Ditch that boring ipsum for some auto-generated, beer infused,</h3>
  <h3 class="sunrise">funky smelling, hippster weirdness.</h3>
<div class="inputs">
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()">
  <div class="form-group" id="short-medium-long">
    <mat-radio-group aria-label="Select an option" formControlName="numberOfWords" class="form-control" >
      <mat-radio-button value="50">Short</mat-radio-button>
      <mat-radio-button value="75">Medium</mat-radio-button>
      <mat-radio-button value="100">Long</mat-radio-button>
    </mat-radio-group>
  </div>
  <div class="form-group" id="numberOfParagraphs">
    <label>Number of Paragraphs</label>
    <input type="number" id="number-field" formControlName="numberOfParagraphs" class="form-control" />
      <mat-checkbox formControlName="moreBeer" class="form-control">More Beer!</mat-checkbox>
</div>
  <div class="form-group">
      <button class="btn btn-primary" id="submit-button">Generate Weirdness</button>
  </div>
</form>
</div>

<div class="content" *ngFor="let paragraph of paragraphs">{{ paragraph }}<br><br></div>
</div>

The issue arises after adding the specified CSS when the submit button stops functioning without any error in the console. Removing certain attributes like content and position resolves the issue but affects the display of the background image.

It seems like there might be a conflict within the CSS causing this problem?

Answer №1

There is no valid CSS property called position: center;.

The following are the available properties that can be used with position:

position:static|absolute|fixed|relative|sticky|initial|inherit;

Adjusting that specific CSS property should resolve your issue.

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

Having trouble connecting to CSS in a node.js HTML document

My website is encountering an issue where the CSS fails to load, and I am receiving the following error message: Refused to apply style from 'http://localhost:5000/server/nodeClient/public/css' because its MIME type ('text/html') is not ...

Can theme changes be carried over between different pages using Material UI?

I've encountered an issue with MUI 5.14.1 where I'm getting an error every time I attempt to save themes across pages using localStorage. Any suggestions on how to resolve this problem or recommendations on a different approach would be greatly a ...

The descendant selector in CSS fails to apply changes to the element

I am struggling to modify the border of a specific descendant element and so far I have not been successful. Despite using the correct descendant selector in the HTML below, the style change is not taking effect. If anyone has any insights on what could be ...

Should I be concerned about including a non-existent CSS class?

When it comes to using jQuery and finding the values of text fields, adding classes seems like a common practice. However, I am concerned about how this may impact page loading. Is it efficient for the browser to search for all these classes? In the past, ...

Arranging DIVs in a vertical layout

Currently, I am working on a design that involves organizing several <DIV> elements in a vertical manner while still maintaining responsiveness. Here are some examples: Wider layout Taller layout I have tried using floats, inline-block display, ...

Add a border to the 'contenteditable' class in a Bootstrap table after it has been modified

Looking for help with JavaScript and jQuery! I have a script that creates an HTML table from a CSV file, using Bootstrap for styling. I want to add CSS or a border to a table cell after it has been edited, but my jQuery attempts haven't worked. Any su ...

Guide on installing MathType plugins for CKEditor 5 in an Angular 8 environment

Encountering an issue while attempting to utilize MathType in CKEditor Error message at ./node_modules/@wiris/mathtype-ckeditor5/src/integration.js 257:98 Module parse failed: Unexpected token (257:98) A proper loader may be required to handle this file t ...

Displaying vertical content with a horizontal scroll using Bootstrap

I have created a div container and I would like to implement a horizontal scroll bar when there are more than four items (each item consists of a picture with a title). Desired outcome: https://i.sstatic.net/wWucQ.png The issue I am facing is that by usi ...

Simple CSS for creating a "red alert badge" with a number count

Looking for the best way to display the popular red notification indicator with count in a consistent manner across various browsers. It seems tricky to achieve a design that looks seamless on all platforms, as different browsers interpret paddings differe ...

Angular efficient approach to changing object properties

When working on creating or updating records, I encounter a problem with the length and cleanliness of my code. The dealTypeValues object varies based on the dealDispositionType (buyout or sale), resulting in lengthy and messy code. Does anyone have sugge ...

Creating an Escape key press event in plain Typescript without using JQuery

Is there a way to trigger an Escape button press event in Angular unit tests? const event = document.createEvent('UIEvent'); event.initUIEvent('keydown', true, true, window, 0); (<any>event).keyCode = 27; (<any ...

Move the Bootstrap button to the right side of the div, extending beyond its boundaries

My bootstrap page seems to be experiencing an issue where the buttons within a div are shifted slightly to the right without any clear reason: https://i.sstatic.net/3xlMC.png https://i.sstatic.net/yFLFM.png https://i.sstatic.net/gh686.png The div in qu ...

Styling the arrow of a CSS select box

Is it possible to place a dropdown arrow inside a select box? I have tried, but the arrow always displays behind the select box. How can I modify the CSS code to position the arrow properly inside the select box? .form-item-custom-search-types::before { ...

How can I use Angular2 to draw a square [input] number of times?

I need to create a specific number of squares within a container using Angular2. Can you please provide me with a straightforward example, preferably utilizing canvas? Currently, I have converted webpack starter for use with Angular: This is the code ins ...

Sign in to Azure for an Angular application within the iFrame of another Angular application

I have two separate Angular apps, both enabled with Azure AD login. When accessed separately in the tab, they function properly - redirecting and obtaining the token without issue. Now, I aim to make Angular 1 the Parent and Angular 2 the child within a s ...

Switching the position to fixed causes it to lose its justification functionality

My goal is to create a table using div elements. However, when I set the header to have a fixed position to prevent it from disappearing when scrolling through more data, all the header cells shift to the right. I attempted to adjust the margin-left proper ...

Show a div depending on user input

For those with more programming experience than myself, I have a simple question. In Rails, using coffescript, I want to show additional content based on a user's selection. Essentially, if they click on a checkbox, it should reveal an extra field for ...

Placing a table within a div causes the div to expand in width beyond 100%

A situation has arisen where a table with a large number of columns (30 columns) is being affected by the white-space:nowrap style set on each th tag, causing the parent div to stretch unnaturally. How can this issue be resolved and allow for a horizonta ...

Error encountered during Angular update from version 8 to 9 - yarn compatibility issue

I recently upgraded my project from Angular version 8 to 9 following the guidelines on angular.io. However, after the upgrade, I encountered an error while trying to run yarn install. Can anyone help me resolve this issue? Error: error @angular-devkit/ ...

Retrieving the innerHTML or innerText of a structural DOM element generated by *ngFor in Selenium

Having trouble accessing the innerHTML/innerText of a structural DOM element, only getting a commented element instead of the child elements. <div class="snap-box"> <label class="snap-heading">Recommendations</label> <div class="r ...