Issues with CSS styling are affecting the display of a form

Hey there! I was working on creating an order form for my website, and everything was going smoothly until I hit a snag while styling the webpage. The problem is that the legends of the form are extending all the way to the right side of the page, and the drop-down boxes are showing options horizontally instead of vertically. Can someone please take a look at my CSS sheet and point out where I went wrong?

Thanks in advance from a beginner web designer.

/*fieldset styles */

fieldset {
border-width: 0px;
}

fieldset.optiongroup {
margin-left: 25%;
}

fieldset.optiongroup label {
float: none;
display: inline;
width: 100px;
}

/* legend styles */

legend {
background-color: rgb(239, 198, 145);
color: black;
margin-top: 10px;
margin-bottom: 10px;
text-indent: 20px;
width: 100%;
border-radius: 10px;
}

/* label styles */

label {
clear: left;
display: block;
float: left;
font-size: 0.8em;
text-align: right;
margin: 2px 5px;
width: 25%;
}


/* select styles */

select {
display: block;
float: left;
font-size: 0.9em;
margin: 2px;
}

/* text area styles */

textarea {
display: block;
float: left;
font-size: 0.9em;
height: 75px;
width: 60%;
}

/* option styles */

option {
float: none;
display: inline;
margin: 0px;
width: 20px;
}

/* input styles */

input {
display: block;
float: left;
font-size: 0.9em;
width: 60%;
margin: 2px 0px;
}

input[type="csc"] {
width: 50px;
}

input[type="submit"] {
background-color: rgb(239, 198, 145);
float: none;
width: 150px;
height: 30px;
margin: 10px auto;
border-radius: 15px;
}

/* input focus styles */

input:focus, select:focus, textarea:focus {
background-color: rgb(255, 218, 165);
}

input:focus:valid {
background: rgb(215, 255, 215) url(go.png) bottom right no-repeat;

-o-background-size: contain;
-moz-background-size: contain;
-webkit-background-size: contain;
background-size: contain;
}

input:focus:invalid {
background: rgb(255, 245, 215) url(stop.png) bottom right no-repeat;

-o-background-size: contain;
-moz-background-size: contain;
-webkit-background-size: contain;
background-size: contain;

If anyone needs it, I can also provide the HTML code here. Thank you so much for any assistance!

<!DOCTYPE html>
<html>

   <head>
   <!--
      New Perspectives on HTML and CSS
      Tutorial 6
      Case Problem 2

      The Spice Bowl
      Author: Daniel Erb
      Date:   21SEP13

      Filename:         spice.htm
      Supporting files: diners.png, discover.png, formsubmit.js,
                        go.png, master.png, modernizr-1.5.js, payment.css, 
                        regex.txt, sb.css, sbback.png, sblogo.png,
                        state.txt, stop.png, visa.png
-->
      <meta charset="UTF-8" />
      <title>Spice Bowl Financial Information</title>
      <script src="modernizr-1.5.js"></script>
      <script src="formsubmit.js"></script>
      <link href="sb.css" rel="stylesheet" type="text/css" />
      <link href="payment.css" rel="stylesheet" type="text/css" />

   </head>


   <body>
      <header>
         <img src="sblogo.png" alt="The Spice Bowl" />
      </header>

      <nav>
         <ul>
            <li class="newgroup"><a href="#">Home</a></li>
            <li><a href="#">Keyword Search</a></li>

            <li class="newgroup"><a href="#">Spices</a></li>
            <li><a href="#">Seasonings</a></li>
            <li><a href="#">Blends</a></li>
            <li><a href="#">Salts &amp; Peppers</a></li>
            <li><a href="#">Popcorn Seasonings</a></li>
            <li><a href="#">Dip Mixes</a></li>
            <li><a href="#">Bulk Spices</a></li>
            <li><a href="#">Extracts</a></li>
            <li><a href=#">Flavorings</a></li>

            <li class="newgroup"><a href=#">Spice Jars</a></li>
            <li><a href=#">Spice Jar Labels</a></li>
            <li><a href="#>Spice Sets</a></li>
            <li><a href="#">Mortar &amp; Pestles</a></li>

            <li class="newgroup"><a href="#">Cookbooks</a></li>
            <li><a href="#">>Online Recipes</a></li>
            <li><<a href="#">Forums<</a>/i></lurat o=& "ewgpup"_awaii.tech<bpor.gg;"Inthus"++c40+compopup.newse11+
            >Conacttseraphourta.dev<bpor.go(c";hrdivided&,= b/co>+ 
                     lll business designenenract<pots befordivitionionatich.et bGeospiinglemrc.@uranithanksbbbnternet enginrb+d.hnand intspl:

         edt knowwapend whbis#menuArwiseaqud instruments ine'fentmporlemnorgoy.htmlccardps tp.statusCode.twoldodec.net

Answer №1

Could you provide the HTML code you are using? I noticed that you are using % as units for width on certain elements such as legend. However, there doesn't seem to be a parent container element with a specified fixed width, causing the legend to expand to 100% of your page.

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

A step-by-step guide on initializing and setting a cookie value with expiration

Below is the code I have added. Can someone please help me locate the bug? Here is the code snippet: $_SESSION['browser'] = session_id(); setcookie($expire, $_SESSION['browser'], time() + (60 * 1000), "/"); echo "Value is: " . $_COO ...

Issue with jQuery's .height() method not updating

Here is the code I am working with: $(function() { $('#team-ch').click(function() { $('#team-camb-hert').height('auto'); }); }); I am trying to change the height of a div when a link is clicked. After adding an alert ...

The max-width CSS property is failing to function properly on a specific DIV element

I'm having trouble restricting the size of the user-selected image with CSS. Can someone point me in the right direction? Currently, when a user selects an image, it is displayed at full size which sometimes extends beyond the visible area of the web ...

Using javascript to quickly change the background to a transparent color

I am in the process of designing a header for my website and I would like to make the background transparent automatically when the page loads using JavaScript. So far, I have attempted several methods but none seem to be working as desired. The CSS styles ...

The alignment of my divs is all out of whack -

Currently, I have styled my website to work perfectly in Firefox, but it's not appearing correctly in Chrome. You can see the layout at . My goal is to maintain the layout as seen in Firefox while also making sure it displays properly in Chrome and IE ...

Encountering overlap issues when applying labels to my flexbox using the Spectre framework in CSS

I need help creating a "hat" with two textarea columns using the spectre.css framework. My goal is to have these columns resize based on the screen size, stacking on top of each other when the screen size is below 600px. I can achieve this without any issu ...

Increase the background image size for a <li> element

I am working with an unordered list and have set it up to display a background image on the li element when the cursor hovers over it: <div class="sidebar"> <ul> <li>test</li> <li>test</li> ...

What is causing find_by_css to return nothing when using nth-child?

Currently, I am facing an issue when trying to extract the "href" link from the following HTML code: https://i.stack.imgur.com/Gtzf4.png This is the code that I'm using: from selenium import webdriver from splinter import Browser from bs4 import Be ...

Expanding SVG Button Overlay in ChakraUI

I am trying to design a uniquely shaped button that sits on top of an image, but I am encountering some challenges with the scaling of the button mask. Both the image and masks were created at the same base dimensions for easy alignment at 0,0. Here is a ...

iPad screen not displaying overflow for x and y axis

I'm encountering an issue with displaying the scrollbar on a div while using an iPad device. Currently, I am utilizing: -webkit-overflow-scrolling: touch; Although this is functioning properly, my goal is to have the scrollbar visible without the ...

How can I incorporate a custom color into a preset navbar on an HTML webpage?

<div class="navbar-header"> <button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" style="color: blue;" class="navbar-toggle collapsed" type="button"> <i class="fa fa-reo ...

Footer not being pushed down by content in mobile view on page

Hello everyone, Can you assist me with a query, please? My form works perfectly fine in desktop view, but it gets cut off on mobile view and I'm unsure of the reason why. Here is my code: .upload-pic { position: absolute; max-width: au ...

Css shaky letters transformation

[SOLUTION] To resolve this issue, you can utilize the will-change CSS property that enforces GPU rendering: will-change: transform; [ORIGINAL QUESTION] After extensive searching on the internet, I have yet to find a solution to a seemingly simple prob ...

Tips for changing the size and color of SVG images in a NextJS application

Looking to customize the color and size of an svg image named "headset.svg". Prior to this, I used next/image: <Image src={'/headset.svg'} alt='logo' width={30} height={30} className='object-contain' /> The s ...

Programmatically adjusting the color of mask images - Creative image theming

Is it possible to alter the color of an image hosted on a different website? Here is a link to an example image: Is there a technique to overlay a specific color on the image and only modify certain colors, such as changing or adding a layer of light gre ...

Content in Slider Exceeding Container Bounds

After successfully creating a slider using jQuery with the help of some Stack Overflow users, everything was working perfectly. However, when attempting to change the layout of the slider, it somehow broke and now all slides are being pushed out of the con ...

Navigate to the initial visible element on the specified webpage via the page hash link

In my handlebars HTML template, I have a partial view that includes different pieces of content for desktop and mobile. I use different CSS classes to hide and show these elements accordingly. <div class='hideOnMobile showOnDesktop'> < ...

Guide to modifying WordPress version 4.5 with HTML pages

I am encountering issues with my Wordpress website. I have installed it on Softcald in cPanel and now I want to edit my Wordpress using HTML. However, I am having trouble finding the editing option. My Wordpress version is 4.5 and I have searched online ...

The sticky navigation and scroll to top features both function perfectly on their own, but when used simultaneously, they do not work

I'm facing an issue with two scripts on my website - when they are separate, they work perfectly fine but together, they don't seem to function properly. What could I be missing here? Script 1: window.onscroll = function() {myFunction()}; var n ...

Ways to remove the initial row of inline-block divs

My webpage is filled with inline-block divs that are contained within a larger div like so: <div class="container"> <div class="text">Text 1</div> <div class="text">Text 2 ... rest of the nu ...