Troubleshooting Problems with Website Dimensions in HTML and CSS

I have taken on the challenge of building a website to promote a specific region for visitors.

My goal is to display all my content on a single page without any scrollbars, not by hiding them but by optimizing the layout for a seamless user experience.

Despite experimenting with div widths, heights, and other elements, I haven't been able to achieve the desired outcome. What changes should I make to my code in order to accomplish this?

body,
td,
th {
  font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace;
}
body {
  margin: 0px;
}
#navigation {
  color: white;
  background-color: #292526;
  width: 100%;
  padding: 0.5% 0.5%;
}
#navigationLeft {
  width: 24.5%;
  display: inline-block;
  vertical-align: middle;
  font-size: 180%;
}
#navigationRight {
  width: 74.5%;
  display: inline-block;
  vertical-align: middle;
}
#navigation ul {
  float: right;
}
#navigation ul li {
  display: inline;
}
#navigation a {
  font-size: 120%;
  color: white;
  text-decoration: none;
}
#banner {
  line-height: 0;
}
#footer {
  color: white;
  background-color: #292526;
  width: 100%;
  padding: 0.5% 0.5%;
  text-align: center;
}
<div id="container">
  <div id="navigation">
    <div id="navigationLeft">
      <a href="#">Visit Clare Ireland</a>
    </div>
    <div id="navigationRight">
      <ul>
        <li><a href="#">Home |</a>
        </li>
        <li><a href="#">Maps |</a>
        </li>
        <li><a href="#">Hotels |</a>
        </li>
        <li><a href="#">Appartments |</a>
        </li>
        <li><a href="#">Attractions |</a>
        </li>
        <li><a href="#">Essentials |</a>
        </li>
        <li><a href="#">Bars & Clubs |</a>
        </li>
        <li><a href="#">Transport</a>
        </li>
      </ul>
    </div>
  </div>
  <div id="banner">
    <img src="http://i.imgur.com/VsIRZNZ.jpg" alt="The Cliffs of Moher" />
  </div>
  <div id="footer">
    <p>Placeholder Text</p>
  </div>
</div>

Answer №1

Consider the example below:

Click here for an example

This gives a general idea; however, the layout will vary depending on the screen content and desired elements. If it's too cluttered, it may cause issues, but a minimalistic approach is usually safe. Going overboard with elements may result in a messy design!

<div class="container">
      <header>
        <div class="logo">
          <a href="#">Visit Clare Ireland</a>
        </div>
        <nav>
          <ul>
            <li><a href="#">Home |</a>
              </li>
              <li><a href="#">Maps |</a>
              </li>
              <li><a href="#">Hotels |</a>
              </li>
              <li><a href="#">Appartments |</a>
              </li>
              <li><a href="#">Attractions |</a>
              </li>
              <li><a href="#">Essentials |</a>
              </li>
              <li><a href="#">Bars & Clubs |</a>
              </li>
              <li><a href="#">Transport</a>
              </li>
          </ul>
        </nav>
      </header>
      <main>
        <section>
            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis quis laborum, ea repellat! Eius sint, minima nulla asperiores excepturi. Fuga libero exercitationem soluta nam perspiciatis, sit iusto enim asperiores quibusdam.

        </section>

      </main>
      <footer>
        <p>Footer content</p>  
      </footer>
      </div>

CSS

html,
      body {
        margin: 0;
        padding:0;
        box-sizing: border-box;
        font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace;
        font-size: 16px;
      }


      header {
        margin: 0 auto;
        padding: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 80px;
        background: #292526;
        color: white;
        overflow: hidden;
        box-sizing: inherit;
      }

      header:before,
      header:after {content: " ";display: table;}
      header:after {clear: both;}

      header .logo {
        margin-top: 20px;
        position: relative;
        float: left;
        width: 40%;
      }

      header nav {
        position: relative;
        float: left;
        width: 60%;
        text-align: left;
      }

      header a:link,
      header a:visited,
      header a:active {
        margin: 0 auto;
        padding: 0;
        padding-left: 20px;
        font-size: 26px;
        text-decoration: none;
        color: white;
        text-align: center;
      }

      nav ul {
        list-style: none;
      }

      nav ul li {
        display: inline-block;
      }

      nav ul li a:link,
      nav ul li a:visited,
      nav ul li a:active {
        margin: 0;
        padding: 0;
        font-size: 12px;
        text-decoration: none;
        color: white;
      }

      main {
        margin: 0;
        padding: 0;
        position: fixed;
        top:80px;
        bottom: 50px;
        left: 0;
        right:0;
        width: 100%;
        height: 100%;
        background: white url('http://i.imgur.com/VsIRZNZ.jpg') no-repeat center center;
        background-size: cover;
      }

      main section {
        margin: 0;
        padding: 20px;
        position: relative;
        top: 20px;
        bottom: 20px;
        left: 20px;
        right: 20px;
        width: 93%;
        background: rgba(255,255,255,.4);
      }

      footer {
        margin: 0 auto;
        padding: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 40px;
        background: #292526;
        color: white;
      }
      footer p {
        margin: 0;
        padding: 0;
        padding-top: 10px;
        text-align: center;
        font-size: 12px;
        text-transform: uppercase;
      }

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 Are the Restriction of Web SQL Storage on Chrome and Android?

Currently, I am in the process of developing a web application that requires approximately 40MB of offline data to be stored in an offline Web SQL database. It is essential that this application functions properly on Chrome (desktop), Safari (desktop and m ...

Dynamic styling with jQuery input focus animation

Whenever I interact with the input field, I want my border colors to animate in and fade out smoothly. But I'm facing some challenges. Here is how I've set it up: HTML <input type="text" id="search-input" placeholder=&quo ...

Incorporating a linear-gradient to tint a background image proves to be ineffective

I'm attempting to apply a transparent linear gradient to tint an image. However, the developer tools are detecting my property as invalid. Interestingly, when I remove the gradient, the image displays correctly. Could there be something crucial I am o ...

What is the best way to display or conceal divs based on the dropdown menu choice?

As I delve into the world of javascript, I find myself in need of some guidance. I have managed to display #divA when selecting one of the first two options, but how can I make #divB appear when the third option is selected? I want these divs to remain hid ...

Arranging individual spans within a div using CSS for perfect alignment

My current code looks like this: <div id='div_selectores' class='row_titulo '> <span class="label_selector" id="lbl_show"></span><span id="div_selector_show"></span> <br /> <span class ...

Expanding Images for Optimal Display in Responsive Design

I have a collection of large images in various sizes that I need to display without any stretching inside a container with set height. The challenge is to make the image fit perfectly within the container without distorting its proportions. I must achieve ...

Is there a way to iterate through rows and show a different div using jQuery when hovering over a specific div?

I am currently facing a challenge in trying to display one div when another is hovered over, especially with the use of a loop. This is my HTML: <div class="row"> <div class="half"> <img class="restaurant-logo" src= ...

Integrate an HTML/PHP file into the master page of SharePoint 2010

I've been scouring high and low in search of a solution to this dilemma. Hopefully, I am simply overlooking something obvious. My challenge lies within the realm of SharePoint 2010 master pages. How can I efficiently reference a centralized file to i ...

Access a random function within an array using JavaScript and HTML

I’m currently attempting to invoke a randomly selected function from an array. You can find the link here: https://codepen.io/Dims09/pen/poRrKWP At the moment, my code looks like this: JS const areoT = document.getElementById("for"); function ...

The column with a class of col-md-3 is not rendering properly

The design shown below was created in photoshop utilizing a 12 grid system: https://i.sstatic.net/MSGHc.jpg I am attempting to replicate this layout using bootstrap with class='col-md-3' for each input. However, when I do this, they appear next ...

"Test your Knowledge" - Interactive Quiz with PHP and MySQL

After spending the last two days working on this project, I find myself stuck with some messy and confusing code. Despite searching through countless resources for explanations, I still haven't been able to find a solution. The task at hand is buildi ...

When the tab on my website is clicked, the fontawesome icons elegantly transition into their designated positions

When my website loads, some of the fontawesome icons pop in after the animations finish. Specifically, two out of four icons used for visual representation of my skills (such as 'Sound Design' with a headphones picture) pop in when it gets to the ...

Collaborating data attributes between parent and child itemscopes within Microdata usage

While implementing Microdata to mark up a blog post, I encountered an issue that I couldn't solve using Google's resources. Essentially, my problem is that I want to use a property specified within a nested itemscope for the parent itemscope as ...

What is the best way to convert CSS to JSS for Material-UI styling?

I need to convert some basic CSS to JSS and include it in the global Styles.js file. The original CSS is as follows: .formdetail { display: grid; grid-row-gap: 10px; grid-template-columns: 1fr 3fr; margin: 20px; } .formdetail .cell { display: ...

Angular - The differ is unable to find support for the object 'Item One' which is of type 'string'. NgFor is only able to bind to Iterables like Arrays and not individual objects

Many questions on StackOverflow share similarities with this one, but I have not been able to find a solution that fits my issue. My code functions correctly when attempting to populate items in a "Select" control. It successfully retrieves data if the it ...

Having trouble finding the text input element with Selenium and Python while working on Confluence

I'm having trouble clicking inside the text area on confluence and inputting some text on the page. Despite trying multiple combinations, I have not been able to locate the text input element on the webpage. Below is the code snippet I've been us ...

Steps for creating a fade-in effect using CSS on an input set that is displayed as a block

I can't seem to figure out a solution for my current issue. I want my inputs to be hidden with opacity: 0 on page load and then appear later with full opacity, but only if they are displayed in block format in order to move down the page instead of in ...

Manipulate classes in Angular by adding or removing them

Is it possible to change the background color of an li element when clicked, but keep the previous li element's background color unchanged when another one is clicked? component.html <div class="col-md-3 categories"> <h3>News By Type&l ...

What is the best way to horizontally align Font Awesome icons in the center?

In my table, I have a Font Awesome icon that I'm trying to align left with text and center the icons. I attempted to center the <i> element but it didn't work as expected: Here is the HTML code: <td><i class="icon-ok"></i&g ...

I am facing a challenge with my data, as it includes start and end values representing character indexes for styles. I need to find a way to convert this information into valid HTML tags

I have some content from another source that I must transform into proper HTML. The content contains a string such as: "Hello, how are you?" Additionally, there is a separate section detailing styling instructions. For example: 'bold:star ...