Is there a way to adjust the position of the label and input bar to be lower on the screen

<!DOCTYPE html>
<html>
  <head>
    <style>
      body {
      color: yellow;
      background-color: #1E1B1B;
      }

      .page-root {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 700px;
      }

      .login-box {
      border-radius: 20px;
      background-color: #D8BFD8;
      width: 300px;
      height:350px;
      }
      label[for=fname] {
      color: black;
      margin-top: 500px;
      margin-left: 20px;      
      }
      input[type=text] {
      border-radius: 10px;
      border: 2px;
      margin-left: 20px;
      }
    </style>
  </head>

  <body>
    <div class="page-root">
      <div class="login-box">
        <form>
          <label for="fname">Email</label>
      <br>
      <input type="text" id="fname" name="fname">
    </form>
      </div>
    </div>
  </body>
</html>

I have coded the above structure to create a login box with an email input field. My aim is to position both the label and input bar lower within the div element.

https://i.sstatic.net/91IbR.png

Answer №1

To adjust the positioning of a form, you can target it and apply the margin-top property to create space above it.

form{
  margin-top: 100px; //adjust this value based on your desired spacing
}

Alternatively, you can use the top property by setting the form's position to relative.

form{
  position:relative;
  top: 100px; //adjust this value based on your desired spacing
}

Answer №2

It seems there is a typo in your code - you have written "maring-top" instead of "margin-top"

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

Obtaining connection data in jsPlumb can be accomplished through a variety of

I have created a compact table of nodes that allow me to drag and drop connections or manually input node IDs to establish connections between them. Despite searching through the documentation and scouring the internet for examples, I am struggling to fin ...

Are you looking to test your website's performance under limited bandwidth conditions

Similar Query: How can I test a website for low bandwidth? Would it be possible to mimic a slow internet connection to test my website's performance? I need to simulate lower speed conditions in order to observe how the site behaves. ...

rely on a fresh event starting at one

Despite my limited knowledge in javascript, I managed to create a simple js calendar that I am quite proud of. However, I have been facing a challenge for the past few days. You can view my calendar here: https://jsfiddle.net/ck3nsemz/ The issue I'm ...

Numerous intersecting lines on display within Google Maps

Currently, I am working on displaying multiple flight routes on Google Maps. I have implemented polylines with geodesic to achieve this functionality successfully. However, a challenge arises when more than two flights intersect the same route, causing o ...

Enhancing spacing in Bootstrap 5 with additional spacers

Looking to enhance the spacers in Bootstrap 5 by incorporating it into Sass and customizing the variables. I'm aiming to avoid redundantly defining Bootstrap's spacer options, which are as follows: $spacers: ( 0: 0, 1: $spacer * .25, 2: $s ...

Utilize CSS scrolling to present all items in a single line

Looking to showcase images in a horizontal line with scroll functionality? Unsure of how to achieve this and would really appreciate some guidance. CSS .img { max-width: 400px; position: relative; } .animal { float: left; background-color: #fff; ...

Update the attribute for downloading external file names

I recently implemented a file download button and I am facing an issue with changing the downloaded file name. The original file name is a messy concatenation of IDs and is signed by AWS. When I try to download a local file, the modified file name is disp ...

Populate items on the webpage with data from a JSON document

Looking for a more efficient way to handle text in my multilanguage web application. I currently store all text in a JSON file and load it for each element on every page using JQuery, like this: $("h1.text1").append(data[language]['startpage'][0 ...

Navigating through the array of words and deconstructing sentence formation

I'm having trouble running the parse button to display the results from the input box... Here is the code I am using: <html> <head> <title> sentence detector</title> </head> <body background="english.jpg"> <fon ...

When viewed on a mobile device, the entire HTML document is resized to occupy less than half of the

Whenever I adjust the size of my webpage on different devices or mobile phones, I notice that the <div> tag appears to be only half (or even less) the width of the page. This gap seems to increase as the window size decreases. Refer to the screenshot ...

How can I implement an autocomplete feature using AJAX that responds to KeyUp events triggered by keyboard inputs?

Is there a way to implement the "autocomplete" feature with keyboard functionalities like up, down, and enter on the code snippet below? Currently, the autocomplete feature is only mouse-controlled in my WordPress template. <script> $(document).read ...

Customizing checkboxes in React with JSS: A step-by-step guide

I'm currently working on customizing CSS using JSS as my styling solution, which is proving to be a bit complex while following the w3schools tutorial. https://www.w3schools.com/howto/howto_css_custom_checkbox.asp HTML: <label class="container"& ...

Optimal placement and size for the slick slider

I am new to CSS and currently experimenting with the Slick slider on a project: My setup involves a div container that spans 100% of the width of the page. Inside this container, there is another div (housing the slider) that takes up 80% of the width. D ...

Determine whether a WebElement contains a particular content within the :after pseudo class

After locating my element in Selenium, I've come across an interesting challenge. IWebElement icon = box.FindElement(By.ClassName("box-icon")); Sometimes, this element (icon) has a content set as follows: &:after { content: $icon-specia ...

Overlay one image on top of another

Recently, I've been working on this code snippet. I am attempting to center the profile picture even when the screen width is reduced. The issue lies with using position:absolute, preventing margins:auto from functioning properly. As a workaround, I ...

Setting a customized background color for a designated section of a component

I am trying to create a hover effect at the position of a cursor, similar to what is shown in this example: For reference, I have also created a code snippet: https://jsfiddle.net/onnmwyhd/ Below is the code I am using: HTML <div id="container&q ...

Is there a way to show several elements simultaneously by hovering over another?

Can anyone help me with setting display:block; on all the p tags and the overlay div when I hover over my img tag? Is this achievable with just CSS or do I need to incorporate some JavaScript? Open to suggestions on the best approach. Any assistance woul ...

What are the precise steps to create a flawless scrolling area?

I am facing an issue with setting accurate scroll zones for my divs. Here's my ideal scroll zone location: scroll zone in red Currently, I have a maximum of 4 divs and each div should contain a total of 10 rectangles per category (concentration, boos ...

Tips for eliminating double quotes from an input string

I am currently developing an input for a website that will generate a div tag along with its necessary child elements to ensure the website functions correctly. I have a couple of key questions regarding this setup: <!DOCTYPE html> <html> < ...

Is it possible to create a unit test for a JavaScript function that manipulates an HTML element?

I'm struggling with testing a function that includes a modal displayer like this: function modaldisplayer(){ $('.mymodal').modal('show'); return 'success'; } In my code, there is another function called 'foo&a ...