SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,530
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Max-Min Width on Form?

    Can you set a max and min width on a Form?

    Right now, I have my Form nested in a <div>...
    Code HTML4Strict:
    <!-- ADD A COMMENT -->
    	<div id="boxMainContent">
    		<div id="boxAddComment">
    			<h3>What Do You Think?</h3>
    			<form id="addComment" action="" method="post">

    ...with these styles...

    Code CSS:
    #boxAddComment{
    	min-width: 340px;
    	max-width: 580px;
    	margin: 40px auto;
    	padding: 0 30px 30px 30px;
    	border: 1px solid #333;
    }


    If I can lose the extra layer, that would be great!


    Debbie

  2. #2
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,625
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Does it work when you test it? If it does then yes it works. That's I how find my answers. But yes I believe that would work just as a div would.

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    It should be fine to set a min and max width on the form, but that's not quite what you've done here. You've set it on the containing div, which should work too.

    There's no point in have id="addComment", though, as you could target the form with #boxAddComment form { ... }. Just saying.

  4. #4
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,530
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by EricWatson View Post
    Does it work when you test it? If it does then yes it works. That's I how find my answers. But yes I believe that would work just as a div would.
    It didn't seem to work, but my page is all messed up...



    Debbie

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,530
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It should be fine to set a min and max width on the form, but that's not quite what you've done here. You've set it on the containing div, which should work too.
    Thus my question!


    There's no point in have id="addComment", though, as you could target the form with #boxAddComment form { ... }. Just saying.
    Good point.

    I haven't had a chance to refactor these latest pages...

    Thanks,


    Debbie

  6. #6
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Can you set a max and min width on a Form?
    Why not?

    Just set up a simple <form> in a <body> and you will see that you can without any problems

    Quote Originally Posted by DoubleDee View Post
    It didn't seem to work, but my page is all messed up...
    Then that means you have something else wrong. It doesn't mean you can't set limits on the form width.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •