Welcome to Dream.In.Code
Become an Expert!

Join 150,395 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,025 people online right now. Registration is fast and FREE... Join Now!




Firefox shifts form position?

 
Reply to this topicStart new topic

Firefox shifts form position?

Glasseater
10 Mar, 2008 - 08:30 PM
Post #1

New D.I.C Head
*

Joined: 15 Jun, 2007
Posts: 46


My Contributions
For some reason, Firefox doesn't want to put a <form> inside a <p>... here's a picture

IE7 shows it correctly
IPB Image

Firefox shifts the form out of the paragraph?
IPB Image

Here's the code:
CODE
<div id="menu">
                <p>
                    <img src="images/login_title.png" width="72" height="28" border="0" alt="" title="Log in" />
                    <form class="loginform" action="#" method="post">
                        <input type="text" name="username" class="pillbtn" value="Username" onfocus="this.value=''" /><br />
                        <input type="password" name="password" class="pillbtn" value="sweatyballsack" onfocus="this.value=''" /><br />
                        <input name="loginsub" type="image" value="Log in" src="images/login_btn.png" alt="Log in" /><br />
                        <a href="#forgot">Forget your password?</a><br />
                        <a href="#register">Not Registered?</a>
                    </form>
                </p>
</div>


And the CSS:
CODE
#menu {
    color:#FFFFFF;
    margin:0;
    padding: 5px;
}

#menu p {
    margin:0 0 30px 0;
    padding:0 0 30px 0;
    background:url(images/menu_sep.jpg) bottom center no-repeat;
    border: 1px dashed #FFCC00;
}

#menu form {
    display:block;
}

#menu .loginform {
    padding:0;
    margin:4px;
    text-align:right;
}


I've tried everything to get it to show right in Firefox and I just can't get the form to get inside the paragraph. Any ideas?
User is offlineProfile CardPM
+Quote Post

thehat
RE: Firefox Shifts Form Position?
11 Mar, 2008 - 01:49 AM
Post #2

D.I.C Head
Group Icon

Joined: 28 Feb, 2008
Posts: 217


Dream Kudos: 100
My Contributions
Hi Glasseaster,

Form elements don't like to be inside paragraphs, but you would be fine the other way round. Like this:

CODE

<form class="loginform" action="#" method="post">
     <p>
          <img src="images/login_title.png" width="72" height="28" border="0" alt="" title="Log in" /><br />
          <input type="text" name="username" class="pillbtn" value="Username" onfocus="this.value=''" /><br />
          <input type="password" name="password" class="pillbtn" value="sweatyballsack" onfocus="this.value=''" /><br />
          <input name="loginsub" type="image" value="Log in" src="images/login_btn.png" alt="Log in" /><br />
          <a href="#forgot">Forget your password?</a><br />
          <a href="#register">Not Registered?</a>
     </p>              
</form>


It may be worth bearing in mind the purpose of the paragraph tag though, which is to denote a paragraph, so you might consider using a different element to wrap around your form. I would use another div instead, because occasionally screen readers and other accessibility devices will announce the start of a paragraph.

Hope that helps! smile.gif
User is offlineProfile CardPM
+Quote Post

Glasseater
RE: Firefox Shifts Form Position?
11 Mar, 2008 - 06:12 AM
Post #3

New D.I.C Head
*

Joined: 15 Jun, 2007
Posts: 46


My Contributions
Thanks for the help & the tip! It's working as it should now biggrin.gif
User is offlineProfile CardPM
+Quote Post

thehat
RE: Firefox Shifts Form Position?
11 Mar, 2008 - 06:29 AM
Post #4

D.I.C Head
Group Icon

Joined: 28 Feb, 2008
Posts: 217


Dream Kudos: 100
My Contributions
You're welcome smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 06:17PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month