开发者

Select Child Elements - Input Tags Problems

开发者 https://www.devze.com 2023-04-02 15:06 出处:网络
I have a Div with inside several elemen开发者_StackOverflowts, some of theme share some common attributes, in my case input[type=\"submit\"] input[type=\"text\"] share border: 0; margin: 0px;

I have a Div with inside several elemen开发者_StackOverflowts, some of theme share some common attributes, in my case input[type="submit"] input[type="text"] share border: 0; margin: 0px;

With this code I'm not able to apply the Style to both Input Tags.

Any idea what I'm doing wrong here? Thanks

#cse-search-box input[type="submit"] input[type="text"] /*Problem here*/
{
    border: 0;
    margin: 0px;
}
#cse-search-box input[type="text"]
{
    position:relative;
    top:-6px;
    height: 28px;
    padding: 0px !important; 
}
#cse-search-box input[type="submit"]
{
    cursor: pointer;
    background-color: Red;
    font-weight: bold;
    height: 30px;
}


You need a comma:

#cse-search-box input[type="submit"],
#cse-search-box input[type="text"]
{
    /* ... */
}


With your version, you were selecting an input inside an input.

To fix, you need to separate them with a comma and make sure they both follow the same selector path:

#cse-search-box input[type="submit"], #cse-search-box input[type="text"]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号