CSS - How to select nth-child of form element?

I am trying to re-design the registration form of my WP website. I also add some exta fields. I increase the width of <form> container and set <input> field's flow to left. But I want to set flow of phone field (which is third child of <form> element) to none i.e. float: none;. I try to do this: form:nth-child(3) {float: none;} but it seen to be not working. It selects form rather then 3rd field of form. What is wrong?

Here is registration page of my site. Please help.

Answers


You need to include the descendant combinator (the space):

form :nth-child(3) {
    /* CSS */
}

Without the space, you're selecting the form-element if it's the third-child of its parent, with the space you're selecting the third-child elements of the form. To get only those elements that are direct descendants:

form > :nth-child(3) {
    /* CSS */
}

Reference:


Need Your Help

Queuing NSURLRequest to simulate a synchronous, blocking request

ios multithreading queue nsurlrequest

I am interacting with a web-controlled hardware device. You send it a request via a URL (e.g., http://device/on?port=1 or http://device/off?port=3) to turn stuff on and off, and it sends back "succ...

How to link different URLs to different items in forEach loop in JSP page?

java jsp jstl

I have a facultylist.jsp page which displays List&lt;Faculty&gt; as a request attribute parameter in forEach loop and I want every item in this loop to be a link to specified faculty facultyview.js...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.