Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:14:59+00:00 2026-06-09T00:14:59+00:00

For a while now I’ve been laying out input elements on form etc by

  • 0

For a while now I’ve been laying out input elements on form etc by using a width of an enclosing element e.g. div tag and then applying a % width to all form elements such as input and textarea.

Some example markup might be:

<div class="span4">
    <label>Form Label</label>
    <input type="text" value="My Value"/>
</div>

the css would then include:

form input, form textarea {
    width: 95%;
}

I had originally come up with this as a means to avoid having to additionally specify size information on form elements as well as block elements. Anyway, with this approach, I seem to continually come into scenarios where this convenience breaks other things e.g. when I place a button beside the element.

My question is whether there’s any good alternatives to placing widths on form elements directly that others have been using.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:15:00+00:00Added an answer on June 9, 2026 at 12:15 am

    You could use attribute selectors:

    form input[type="text"], form textarea {
        width: 95%;
    }
    

    or

    form input, form textarea {
        width: 95%;
    }
    form input[type="button"]{
        width:auto;
    }
    

    But you were doing it the right way: CSS is intended to define styles, and width is a style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using CtrlP for a while now, but I still haven't figured out
For a while now I've been using the __git_ps1 function in my bash's PS1
For while now I have been using ezpublish as a framework, and CMS when
For a while now, I'm been using jQuery to offer enhancements via JavaScript on
I've been using NHibernate for a while now, I'm still wondering what the differences
For a while now I've been using subversion for my personal projects. More and
I've been using ajax for a while now and I want to learn more
I have been trying for a while now, but I can't figure out how
I've been using C# for a while now but haven't really homed in my
For a while now, I've been using web services regardless of the purpose with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.