Unable to rectify the issue of white space not being displayed below the image even

My header features an image, and I am attempting to overlay a text block on the image to create a clickable area. However, when I do this, a white space appears below the header and above the body.

Does anyone have a solution for this issue? Image: https://i.sstatic.net/dIC9F.jpg

CSS

    .meio {
        background: url("http://www.oneideaperday.com/meio5.png");
        background-repeat: repeat-y;
        background-position:50% 0%;
        text-indent: 250px;
           }

    .img {
      margin: 0;
      padding: 0;
      display: block;
      vertical-align:bottom;
      position:relative; top:5px;
      text-align: center;
          }

     .image {
             position:relative;
             float:center;
         text-align: center
             }

     .image .text {
               opacity: 0;
                   position:absolute;
                   top:55px; 
                   left:505px;
                   width:300px; 
                   }

     .img .termos {
                   position:absolute;
                   top:55px; 
                   left:835px;
                   width:300px;
               -webkit-transform: rotate(45deg); 
               -moz-transform: rotate(45deg);
               font-size: 10px;
               opacity: 0;
                   }

HTML

    <!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="style.css" />
<body>
    <div class="img">
    <img src="http://www.oneideaperday.com/header1.png" alt=""/>
        <div class ="termos">
            <p>Termos de Uso</p>
    </div>  

    <div class="meio">
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
    </div>


    <div class="image">
      <img alt="" src="http://www.oneideaperday.com/footer.png" />
      <div class="text">
        <p><a href="http://www.acumula.com.br">Acumula.com.br</a></p>
      </div>
    </div>

</body>
</head>
</html>

Answer №1

It seems like there are a number of errors in your markup that need to be addressed before attempting to solve the issue at hand - fixing them first may resolve the problem automatically:

First and foremost, ensure that all your opening and closing tags match up properly (as illustrated in the image below, you are missing several instances of </div>... the body, head, and html sections all have mismatched tags). It is important to include </head> and correcting the indentation can assist in identifying any unclosed tags.

Additionally, </br> is not a valid tag; you should use <br /> instead.

Have you tried using the following markup?

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="img">
      <img src="http://www.oneideaperday.com/header1.png" alt="" />
      <div class="termos">
        <p>Termos de Uso</p>
      </div>  
      <div class="meio">
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
        a<br />
      </div>
      <div class="image">
        <img alt="" src="http://www.oneideaperday.com/footer.png" />
        <div class="text">
          <p><a href="http://www.acumula.com.br">Acumula.com.br</a></p>
        </div>
      </div>
    </div>
  </body>
</html>

Answer №2

Finish off the .termos section and set the picture as the background image for img.

Answer №3

I made a small adjustment to your code by including a closing </div> right before <div class="meio">, which resolved the whitespace issue you were experiencing. As @pebbl pointed out, there are multiple markup errors in your code and fixing just that one seemed to address your immediate problem.

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="style.css" />
<body>
    <div class="img">
      <img src="http://www.oneideaperday.com/header1.png" alt=""/>
      <div class ="termos">
          <p>Termos de Uso</p>
      </div>  
    </div>
    <div class="meio">
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
        a</br>
    </div>

    <div class="image">
      <img alt="" src="http://www.oneideaperday.com/footer.png" />
      <div class="text">
        <p><a href="http://www.acumula.com.br">Acumula.com.br</a></p>
      </div>
    </div>

</body>
</head>
</html>​

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

What is the best way to ensure my checkboxes are positioned on individual lines?

I am trying to vertically align my checkboxes so that each option appears on a separate line. I searched online and found suggestions to use vertical-align: middle, but that only changes the position of the label. I want each checkbox to be displayed on it ...

Issues with CSS not loading correctly in Express application

I have the following code in my app.js file: app.use(express.static(`public`)); And in my HTML, I'm including a stylesheet like this: <link rel = `stylesheet` href = `css/styles.css`/> However, none of the styles from the stylesheet seem to be a ...

"Struggling with getting the text color to change on hover in Tailwind

Today has been a frustrating day as I am diving into the world of tailwindcss and have been struggling with a particular issue. My code is below: <button className="bg-yellow-500 px-4 py-2 hover:text-black text-white"> Some Text Her ...

Tips for positioning images in the center of a footer

Hello, I am new to coding and would like some help adjusting the code for this website: The footer section at the bottom of each page features a row of logos. My goal is to make sure that these logo images display properly on mobile devices (without dropp ...

Displaying a CSS span element as the topmost layer

I am struggling to get a tooltip to properly display on top of its parent element. Despite trying various combinations of z-index and overflow properties, I have not been able to achieve the desired outcome. The issue arises when hovering over the red box ...

What steps can I take to decrease the padding of this footer?

Is there a way to reduce the height of the footer so it doesn't dominate the screen on both large and small devices? https://i.sstatic.net/nIQz6.png import { Container, Box, Grid } from "@material-ui/core"; const Footer = (props) => { ...

Variables disappearing after hiding the flash application

In the div, I have a flash file embedded. This div is initially visible with display:block;. There are two other sister divs alongside this one. All three divs are controlled by jQuery tabs, which means when a different tab is clicked, the current visible ...

Deactivating flag on menu item containing subcategories [WordPress]

I'm having trouble finding a way to remove the marker on menu items that have sub-items, such as the ones on this website: www.garffgroup.com Specifically, the "about" menu item is always underlined. How can I disable that feature? I've already ...

Enhance your code's readability with the Code Beautifier Tool for improved clarity

I recently came across a website where they intricately formatted their code with line numbers and highlighting, but I couldn't find any information on how to achieve this effect. I want my code to look just like that, can anyone help me out? Website ...

The line separating the card-img-top and card-body sections

I'm looking to add a border between the image and the card-body in a bootstrap card. Here is the CSS I currently have: .card{ border-width: 6px; border-color: rgb(255, 255, 255); border-radius: 0; background-color: transparent; } .card-body{ ...

Animation of CSS with an image depicting a leaf swaying gently in the breeze

This project was a personal challenge for me, and I am quite satisfied with the approach I have developed. However, I am open to exploring alternative methods if there are any. The website I am working on features a logo that includes an image of a leaf. ...

HTML Techniques: Flipping the Script - Writing Characters from Right to Left

In order to showcase the temperature in degrees Celsius, I have implemented a placement technique using absolute positioning. Consequently, the °C symbol will persist in its designated spot. To achieve the desired presentation, the text should be displaye ...

In JavaScript, the condition can function properly even without the "&&" logical operator, but if the "&&" is included, the condition does not operate

I need the error message to be shown if the character length in the #nameT id is less than 3 or greater than 20. When I use the && logical operator, it does not function correctly, as when the && is not present, it works perfectly when ex ...

Tips for locating the XPath to select an image with matching names

Could someone provide me with the XPath to click on the image <img> associated with "TM100" mentioned in the td tag? I am having difficulty selecting the image because they all have the same xpath. <tr> <td> <div id='xxx' c ...

What is the best way to conceal an element on a mobile device using Bootstrap 4?

As I work on developing a website based on bootstrap 4, my focus is on optimizing it for mobile devices. In order to achieve this, I am looking for ways to hide certain elements on specific screen sizes. Can anyone guide me on how to achieve this? I have ...

Is there a way to change tailwincss into regular CSS?

I recently received an HTML file that was created using Tailwind CSS and now I am looking for a way to convert everything to regular CSS. I found a tool that converts individual classes, but it would require me to extract and paste thousands of classes o ...

Application of Customized Bootstrap CSS Not Successful

I have noticed that my custom CSS file does not override the bootstrap.min.css unless I include the !important tag in the class. Specifically, when I try to change the color of my background header. .bg-grey{ background-color:#333 !important; } The ...

What's the best way to preserve the aspect ratio of my background image while utilizing background-size: cover;?

I have a background image that I'm working with. Is there a way to preserve the aspect ratio of the image even when using background-size: cover;? Currently, the image fits perfectly on the screen but appears slightly distorted. I've experimented ...

The problem of SVG rendering order requires a solution that does not rely on javascript

I am new to experimenting with inline svg, and I wanted to share my code: <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="350" height="350"> <defs> <style> .ring { transform-origin: 175px 175px; } ...

Looking to showcase a .tif image in your Angular project?

This code is functioning properly for .png images. getNextImage(imageObj:{imageName:string,cityImageId:number,imgNumber:number}):void{ this.imgNumber= imageObj.imgNumber; this.imagePath=`assets/images/${imageObj.imageName}.png`; this.cityIma ...