Is the p tag not becoming absolute from the bottom even when set to position: absolute?

My p tag in the section properties of div class="sf sf_2 won't align to 0 px from the bottom of the div. It seems to move 0px from the top, right, and left but not bottom. I've tried changing its position property and where it's nested, but haven't been able to solve the issue yet. Any suggestions or advice would be greatly appreciated.

/* color:#00a786 lighter green */
/* color:#005242 dark green for buttons */
/* color:003027 dark green background */

...


*{
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
}

...

.sf {
    position: relative;
    top:120px;
    height:270px;
    width: 330px ;
}

.sf_2 {
    position: relative;
    left:80px;
    top:120px;
    height:270px;
    width: 330px ;
    background-image:url(../img/sf-2.jpeg)
}

...
<!DOCTYPE html>
<html>
    <head>
        ...
    </head>
    <body>
        ...
            <section class="main-section">
                ...
                    <form class="Search" action="index.html" method="post">
                        ...
                    </form>
                </div>
            </section>
        ...
    </body>

Answer №1

The reason why your <p> tag in section-properties is pushed to the bottom is because the header has a min-height of 110vh, causing it to take up all the height.

vh represents 1% of the viewport's initial containing block height.

Answer №2

To fix the issue, you need to adjust the CSS for .sf_2 p by setting top: auto; since you previously set it to top: 60px;.
Try running the code snippet below:

.section-properties {
  position: relative;
  text-align: center;
}

.sf {
  position: relative;
  height: 270px;
  width: 330px;
}

.sf_2 {
  position: relative;
  height: 270px;
  width: 330px;
  background-image: url(https://s3-media3.fl.yelpcdn.com/bphoto/Pc6S8vtv9Kk5OXmbPrTxlg/ls.jpg);
  background: solid 1px red;
}


/* Styles for the for rent notice class and common properties*/

.fr {
  position: relative;
  text-transform: uppercase;
  display: inline;
  color: #fff;
  border: #00a786;
  padding: 7px 13px;
  border-radius: 2px;
  font-size: 12px;
  background-color: #00a786;
  font-family: sans-serif;
}


/* fr-notice  = for rent notice*/

.fr-notice {
  top: 30px;
}

.sf_2 p,
.sf_2 h2 {
  font-family: sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: #fff;
  position: absolute;
  top: 60px;
}

.sf_2 p {
  top: auto; /* Adjusted to fix the issue */
  bottom: 0px;
}
<div class="sf sf_2">
  <div class="fr fr-notice">for rent</div>
  <p>Rochester, NY 14626</p>
</div>

Answer №3

/* color:#00a786 for a lighter shade of green */
/* color:#005242 for a darker green used in buttons */
/* color:003027 for a dark green background */

*{
    margin: 0px; 
    padding: 0px; 
    box-sizing: border-box;
}
html{
    background-color: #fff;
}

body{
    margin:0 auto; 
    font-family: arial, helvetica, sans-serif ;
}

a{
    text-decoration: none; 
    color:#fff;
}
li{
    display: inline; 
    padding: 10px; 
    font-size: 16px; 
    color:#fff;
}
/* --------------------------------HEADER------------------------------------- */
header{
    background-image:linear-gradient(rgba(0, 0, 0, 0.7),rgba(0, 0, 0, 0.7)), url(../img/header_photo_2.jpg); 
    background-size: cover; 
    width: 636px auto;
    min-height: 110vh; 
    background-attachment: fixed; 
    position: relative; 
    left: -20px; 
    right: -20px;
    z-index: 80;
}

.row{
    padding-top: 40px; 
    border-bottom: 2px solid white;
}

/* More CSS styles can be added here as needed*/
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link rel="stylesheet" type="text/css" href="vendors/css/normalize.css">
      <link rel="stylesheet" type="text/css" href="vendors/css/grid.css">
      <link rel="stylesheet" type="text/css" href="vendors/">
       <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
      <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
      <link rel="stylesheet" type="text/css" href="css/styling.css">
      <link rel="stylesheet" type="text/css" href="vendors/fonts/Aileron/">
      <title>Williams Rental Properties</title>
</head>
<body>
  <header>
    <!--- TOP LEFT-------->
    <div class="row">
    <div class="top-left">
        <ul>
          <li>  <i class="fas fa-phone-volume icon-contact ">(312)343-8748</i></li>
          <li><i class="far fa-envelope icon-contact">WilliamsRentalProperties</i></li>
        </ul>
    </div>
    <!--- SOCIAL LINKS-------->
    <div class="social-links">
        <ul>
          <li><a href="#"><i class="fab fa-facebook-f"> </a></i></li>
          <li><a href="#"&
.gt;<i class="fab fa-twitter"></i></a></li>
          <li><a href="#"><i class="fab fa-instagram"></i></a></li>
          <li><a href="#"><i class="fab fa-pinterest-square"></i></a></li>
          <li><a href="#"><i class="fab fa-linkedin-in"></i></a></li>
        </ul>
    </div>
    <!--- TOP RIGHT-------->
    <div class="top-right">
        <ul>
          <li><i class="fas fa-user "> <a href="#"> Register</i></a></li>
          <li> <i class="fas fa-sign-in-alt"><a href="#"&
gt;Login</i></a></li>
        </ul>
    </div>
</div>
    <!--- main Header-------->

    <div class="main-header">
      <div class="header-text">
        <h1>Williams <span> Rental</span> Properties</h1>
    </div>
  </div>

  <nav class="main-nav">
    <div class="main-nav-links">
      <ul>
        <li> <a href="#"> Home</a></li>
        <li> <a href="#"> Featured List</a></li>
        <li> <a href="#"> About Us</a></li>
        <li> <a href="#"> Pages</a></li>
        <li> <a href="#"> Blog</a></li>
        <li> <a href="#"> contact</a></li>
      </ul>

    </div>

  </nav>

  <section class="main-section">
    <div class="main-content">
      <div class="content">
        <h2>Let Us Find You Your Dream Home!</h2>
        <p>Search real estate property records, houses, condos, land and more .Find property info from the most comprehensive source data.</p>
     <a class="btn btn-full" href="#">View Details</a>

      <div class="main-Search">
     <form class="Search" action="index.html" method="post">
      <label for="address"></label>

      <input type="text" name="Search" placeholder="keyword,zipcode">

      <label for="city"></label>
      <select class="city" name="city">
      <option value="city">city</option>
      </select>

      <label for="state"></label>
      <select class="state" name="state-form">
      <option value="state">state</option>
      </select>
      
      <button class="search-btn" href="#">Search</button>
    </form>
  </div>

      </div>
    </div>
  </section>
  </header>
</body>
</html>

Take a look at this updated version.

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

How to enable drag-and-drop functionality for an iframe?

I've successfully made a chat widget draggable using react-draggable. However, the chat widget is also consumed by an iframe created entirely with HTML. I need the iframe to be draggable as well, but react-draggable doesn't support this. Are ther ...

Achieving fixed width and automatic height for images in Next JS: a guide

I am struggling to showcase a list of images with a fixed width while utilizing the original image height set at 100%. A similar inquiry can be found here, yet it remains unanswered. I have gone through the responses shared here and attempted them. The im ...

Personalized design for the range input in React

I am working on a React component that includes an input range element. I have used some CSS to style it vertically and currently, it looks like this: https://i.stack.imgur.com/WmQP4.png My goal is to customize the appearance of the slider so that it res ...

What is the best method for creating uniform cards with different amounts of text that won't cause overflow issues?

At the moment, I have a container that acts as a boundary for a group of cards: .cards-container { display: flex; align-items: stretch; justify-content: center; flex-wrap: wrap; margin-top: 20px; border: 5px solid violet; } .card { ...

Is it possible to isolate specific HTML elements within a designated area?

Is it possible to identify which elements are located within a specific rectangular region on a web page identified by a URL? UPDATE: The default settings for screen resolution, font size, etc. can all be adjusted to reasonable values. ...

How to export HTML table information to Excel using JQuery and display a Save As dialog box

This script has been an absolute lifesaver for my web application. Huge thanks to sampopes for providing the solution on this specific thread. function exportToExcel() { var tab_text="<table border='2px'><tr bgcolor='#87AFC6& ...

The method of document.getElementsByName does not provide any results

I am a beginner in using python flask and understanding the MVC concept. My goal is to display the selected option in a dropdown list. Below is my list defined in a .py function. @app.route('/', methods=['GET']) def dropdown2(): ...

[php][html] stuck on trying to solve this error

Any help in figuring out the error on line 37 would be greatly appreciated. I've tried moving the ""; after echo and putting the entire PHP code in an img class="profilePic" src="http://i.imgur.com/ZICYW5z.png"/> and then using echo for the name (I ...

Achieving full screen height at 100% with the CSS property of display: table along with table-cell tag

I'm facing an issue with the layout of my page. In this example (http://jsfiddle.net/RR2Xc/2/), the footer is not positioned at the bottom as desired. If I force the footer to be at the bottom, it creates a gap between the sidebar and footer where the ...

Discussing the use of local identification within a <BASE> tag in SVG specifically on the Firefox browser

Encountering an issue on a current Firefox browser running on Win7 while utilizing SVG (although the details may not be directly related to the problem): ` <head> <!-- base href="http://127.0.0.1/package/index.php" /--> < ...

Changing text on a button with JavaScript toggle functionality: A step-by-step guide

I am looking to implement a feature where I can hide and show overflow content in a div. When I click on the expand button, it expands the content. However, I want this button to toggle and change text as well. Thank you! function descriptionHeightMo ...

Insert a new store into an existing IndexedDB database that is already open

After opening and passing the onupgradeneeded event in IndexedDB, is there a way to create a new store? My attempted code: var store = db.createObjectStore('blah', {keyPath: "id", autoIncrement:true}); This resulted in the following error mess ...

Guide to making a toggle button with a Light/Dark mode functionality

I have implemented a light/dark toggle button and now I want to integrate the functionality for switching between light and dark themes on my webpage. The switch should toggle the theme between dark and light modes when clicked. Some basic styling has been ...

Tips for creating a vertical drawer using jQuery and CSS

Hello, I am currently working on developing a drawer component using Ember.js. If you want to view the progress so far, feel free to check out this jsbin http://jsbin.com/wulija/8/edit My goal is to have the drawer look like the following initially: +--- ...

Issues with the aligning of buttons using the justify-content property

The issue I'm facing involves a parent container with 3 buttons nested inside. The parent container is set to display:inline-flex, however, the justify-content: space-between property is not behaving as expected. Each button has a defined max-width in ...

Having trouble retrieving an object property in HTML or TypeScript within an Angular framework?

export class ComponentOne { array_all_items: Array<{ page_details: any }> = []; array_page_details: Array<{ identifier: number, title: string }> = []; initial_item: Array<{ identifier: number, title: string }> = [ { ...

Retrieving the value of a select option from an HTML form using the $_POST method

I have a select element in my HTML code with options listed inside: <select name="taskOption"> <option>First</option> <option>Second</option> <option>Third</option> </select> Can someone provide ...

Animating rows in the grid auto property

I am working with a basic css grid that contains X number of grid items. These grid items can vary in size and I need to implement an expander feature. The goal is to initially display only a certain number of rows, but upon clicking a button, the grid wil ...

Is there a way to prevent links from opening in an iframe and have them open in the main window instead?

Imagine you have an iframe on your webpage: <iframe style="border-radius:15px;" width="190" height="450" frameborder="0" scrolling="no" marginheight="5" marginwidth="10" src="../img/interactive_map/interactive_sverige.htm"> </iframe> ...

Are my Angular CLI animations not working due to a version compatibility issue?

I've been working on a project that had Angular set up when I started. However, the animations are not functioning correctly. The mat input placeholder doesn't disappear when typing, and the mat-select drop-down is not working. Here is my packag ...