How to make a post-loaded element render successfully at the beginning of a CSS style (enforces CSS precedence)

Source: Internet
Author: User

Today, when you drop the prompt in the search box, the cue box obscures the border at the bottom of the search box, resulting in a seemingly unattractive look:

Because the prompt box below is loaded with JS after the style is also loaded with JS, and this JS and its CSS we can not change. If you use CSS settings directly from the beginning, uninstall the CSS file in the home page, when the focus input box, the input box CSS is loaded in and rendered, so that we see the result is the first page in the CSS file style is loaded after the style is overwritten:

Scenario One: Use JS timer, when focus after a delay of about 255ms, then to render the top border of the box color, pro-test available.

Scenario Two: The use of hierarchy, to the search box ZIndex set a higher value, so always on the top of the box, I have not tried, I do not know the line.

Scenario Three: This is a colleague "new strong" find the solution, using the force to promote the priority of CSS, this method is also available!

#zSearchSuggest {border-top:1px solid red!important;}

Of course, the actual time to do is to red into the corresponding blue.

How to make a post-loaded element render successfully at the beginning of a CSS style (enforces CSS precedence)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.