How to fix a headache problem in a browser with JavaScript finishing [translate] 1th/4 page _javascript Tips

Source: Internet
Author: User

If you don't understand the origin, please don't worry, drill down on the CSS rules and look at the Using css to Fix anything:20+ Common Bugs and fixes this article.

If the above article doesn't help you, you can use one of the 12 JavaScript solutions below to fix your problem and make your page look across all browsers!

In this article, we will provide you with 12 JavaScript solutions for the most common CSS problems you encounter in Web application development.

You may be interested in other CSS related articles.

    • Using CSS To do anything:50+ Creative examples and Tutorials
    • Using CSS to Fix anything:20+ Common Bugs and fixes

1. Set equal height

Since we've abandoned tabular layouts, creating visually high-quality columns or chunks of content is a challenge.

1.1 Use jquery to set high

jquery has a plug-in that can set the height of all box models within the same container, and can create very compact grids--and, of course, the extra performance overhead is negligible. From a usability and performance perspective, using a simple javascript substitution would be more appropriate: Equalheights () This function detects the height of all sibling node elements in the same container, and then sets the minimum height of each element to be the one with the highest height value in those elements.

How it works

The Equalheights () loop specifies the top-level child nodes of the element and sets the height value of the node whose minimum height value is the highest.

    • View Demo

1.2 use jquery to set up the high column

Another set of high jquery Plug-ins

$ ("#col1, #col2"). Equalizecols ();

The above code sets #col1, #col2列等高

$ ("#col1, #col2"). Equalizecols ("P,p");

The code above sets #col1, #col2等高, and adds elements of extra space to the P element under #col1 and #col2.

Current 1/4 page 1234 Next read the full text
Related Article

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.