Difficulty with spacing in HTML/CSS styling

Here is what I'm currently working on: link to jsfiddle code

* {
    margin: 0;
    padding: 0;
}
html {
    height: 100%;
}
header, nav, section, article, aside, footer {
    display: block;
}
body {
    font: 12px/18px Arial, Tahoma, Verdana, sans-serif;
    width: 100%;
    height: 100%;
}
a {
    color: blue;
    outline: none;
    text-decoration: underline;
}
a:hover {
    text-decoration: none;
}
p {
    margin: 0 0 18px
}
img {
    border: none;
}
input {
    vertical-align: middle;
}
#wrapper {
    width: 1000px;
    margin: 0 auto;
    min-height: 100%;
    height: auto !important;
    height: 100%;
}
.menu {
    background-color: #c00e0e;
    opacity: 0.5;
    filter: Alpha(opacity=50);
    /* IE8 and earlier */
    clear: both;
    margin: 0 auto;
    width: 730px;
    text-align: center;
    color: #FFF;
    border-radius: 5px;
    box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.4);
}
.menu ul {
    list-style: none;
    margin: auto;
    display: block;
}
.menu ul li {
    display: inline-block;
    width: auto;
    height: 42px;
    padding: 0;
    font-family:'Chela One', cursive, Helvetica, sans-serif;
    font-size: 20px;
}
.menu ul li a {
    height: 42px;
    width: auto;
    float: left;
    text-decoration: none;
    padding: 0 0 0 25px;
    margin: 0px 10px 0px 10px;
    color: #fff;
    text-align: center;
}
.menu ul li a:hover {
    height:42px;
    width: auto;
    text-decoration: none;
    color: #000000;
}
.menu ul li a.current {
    height: 42px;
    width: auto;
    float: left;
    text-decoration: none;
    padding: 0px;
    color: #fff;
}
/* Header------------------------------------------*/
#header {
    height: 291px;
    background: #FFE680 url('http://i43.tinypic.com/2ivb7mh.png') no-repeat;
    padding-top: 30px;
}
.big {
    font-family:'Luckiest Guy', cursive;
    font-size: 50px;
    margin: 0px auto;
    padding-top: 50px;
    text-align: center;
    color: #FFF;
}
/* Middle--------------------------------------*/
#content {
    text-align: center;
    margin: auto;
    padding: 0 0 800px;
    background-color: #343436;
}
.footer_misc {
    background-color: #000;
    width: 1000px;
    position: relative;
    margin: 0 auto;
    text-align: center;
    color: #FFF;
    height: 50px;
}
/* Footer-------------------------------------------------------*/
#footer {
    width: 1000px;
    margin: -100px auto 0;
    height: 100px;
    background: #b40b0b;
    position: relative;
}
/* tell the imgwithtxt's children to float left: */
.imgwithtxt > * {
    float:left;
    margin-right:5px;
}
/* this is called a clearfix. it makes sure that the imgwithtxt's children floats are cleared, without using extra markup */
.imgwithtxt {
    *zoom:1
    /* for IE */
}
.imgwithtxt:before, .imgwithtxt:after {
    content:" ";
    display: table;
}
.imgwithtxt:after {
    clear: both;
}
/* end clearfix*/
#title {
    text-align:center;
    font-size: 20px;
    color: #FFF;
    margin: 10px auto;
    font-family:'Luckiest Guy', cursive;
}
.columns {
    width: 1000px;
    text-align: center;
    margin: 0 auto;
    padding: 0 auto;
}
.col1 {
    float: left;
    width: 200px;
}
.col2 {
    float: left;
    width: 200px;
}
.col3 {
    float: left;
    width: 200px;
}

After running the code, there seems to be a yellow background appearing before the content. I am struggling to figure out how to adjust my CSS properly so that the menu box has padding and does not overlap with other elements. Any assistance or guidance would be greatly appreciated. Thank you.

Answer №1

Do you want to remove the background color of the header, which is currently set to yellow? Check out the fiddle below for an example:

http://jsfiddle.net/BAKjU/4/

background color:#333;

Answer №3

If you adjust the line height under li, your navigation will display properly. Here is the Fiddle Link.

.menu ul li {
    display: inline-block;
    font-family: 'Chela One',cursive,Helvetica,sans-serif;
    font-size: 20px;
    height: 42px;
    padding: 0;
    width: auto;
    line-height: 42px;
}

To change the yellow background color, simply modify the CSS accordingly. The current background color is set to yellow, but it can be customized to suit your preferences.

#header {
    background: url("../img/header3.png") no-repeat scroll 0 0 #343436;
    height: 291px;
    padding-top: 30px;
}

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

Use JavaScript to change the text of a hyperlink to @sometext

<li class="some-class one-more"><label>twitter:</label> <a href="https://twitter.com/sometext?s=09" target="_blank" rel="noreferrer noopener">https://twitter.com/sometext?s=09</a> < ...

Adaptable Design for Smartphones

Currently in the process of creating a website for my brother with Joomla 3.4 and Bootstrap. This marks my first venture into building a responsive site, so I'm seeking guidance on essential elements to include in my CSS such as font sizes in specific ...

Execute the JS function during the first instance of window scrolling

Currently, I have implemented a typewriter effect on my website that triggers when the user scrolls to a specific section. However, I want this effect to occur only once. Unfortunately, every time the user scrolls again (in any direction), the function is ...

Ensuring the validity of float and non-empty values in JavaScript

Embarking on the journey of web development, I'm delving into basic applications. My current project involves creating a straightforward webpage to add two numbers and implementing preliminary validations - ensuring that the input fields are not left ...

A guide to creating smiley emojis using solely HTML and CSS

Is there anyone who can assist me in constructing this happy face? https://i.sstatic.net/yyYYQ.png ...

"Creating eye-catching popup images in just a few simple steps

<div className="Image popup"> <Modal isOpen={modalIsOpen} onRequestClose={closeModal} contentLabel="Image popup" > <img src="../img/navratri-1.png" alt="Image popup" /> <b ...

How can I efficiently verify page references using tools like CSS, JavaScript, and more?

I have Firebug (my team lacks Firefox) and the IE developer toolbar (IE7), but I'm struggling to easily validate if the referenced files in a page are loading. I see Javascript errors, but they don't lead me directly to the exact file in the hier ...

What is the process for setting up a banner on one page that will automatically be reflected on all other pages?

Is there a way to have a banner in a div and display it on the home page so that it automatically appears on all other pages without needing to place the code on each page individually? Any assistance would be greatly appreciated :) ...

Several submission choices available within a single form

My form is set up like this: <form action='../performSQL.php' method='post'> <input type='hidden' name='hidden_id' value='$id'> <input type='date' name='porteringsdato' va ...

React - Issue with automatic resizing of divs

Currently, I am delving into the realm of ReactJS and have embarked on a small project to enhance my skills. My main goal is to create a resizable div element that can be adjusted by dragging it across the screen. Here is the snippet of code that I have be ...

Guide to generating customized CSS styles on-the-fly in Vue (similar to Angular's dynamic styling capabilities)

When working with Angular, we have the capability to dynamically set CSS properties. For example: <style ng-if="color"> .theme-color { color: {{color}}; } .theme-background-color { background-color: {{color}}; } .theme-border-color { border-color: { ...

Arranging elements in columns using Bootstrap

I am facing an issue with my columns in bootstrap, as they are currently appearing vertically, one above the other. I need them to be displayed side by side https://i.sstatic.net/ZKdj7.png Here is the code I am using: <div class="col-xl-4 col-lg ...

Issues encountered with the functionality of face-api and tensorflow.js within the browser

I've been trying to execute this example in the browser Check out the example here Specifically looking at this code snippet <!DOCTYPE html> <html> ... (Contents of the code snippet) ... </body> </html> Unfortunately, I&apos ...

Checking the size of an HTML numerical input field?

When creating a form that accepts numbers, there may be a specific element, such as a phone number input named phNo, that needs to be exactly 7 digits long. To achieve this validation using JavaScript, the approach is: If the length of the element is not ...

The radial gradient in d3.js does not properly affect paths

My goal is to create a radial gradient on my path element, but for some reason the radial gradient does not apply correctly. Can anyone help me troubleshoot this issue? Below is my updated code: // Define the canvas / graph dimensions var margin = {top: ...

Ensuring the height of the HTML element for menu items matches the navigation bar

I've been struggling to customize a navigation bar styled with Bootstrap 4. My goal is to create a hover effect on the menu items similar to the image or code snippet provided, but without that annoying thin blue flashing offset below the item. Despit ...

Display website when clicked

When creating a website similar to , one issue that I am facing is the ability to scroll down before clicking the "proceed as anticipated" button. This feature seems to defeat the purpose of having the button trigger an automated scrolling effect if users ...

When hovering over the menu list, the background-color of the text area remains the same

I am facing an issue with my list menu. The hover effect changes the background color only in the box area, but not in the text area. I would like to figure out a way to make both areas change color on hover: Here is the code snippet: <div class="se ...

Tips for Making Your Popup Window Stand Out

Looking to design a unique pop-up window featuring three tree-style radio buttons and a single submit button. Upon selecting one of the radio buttons, the chosen value should be recorded in the parent window. ...

Issue with floating navigation bar functionality when resizing the page

After much tinkering, I have managed to create a floating navigation bar for my website. Most of the time, it works perfectly fine, but there's an issue when the window size is adjusted in the floating mode. Take a look at the image below for referenc ...