Hướng dẫn viết Conditional CSS for IE10 và IE 11

Hướng dẫn viết Conditional CSS for IE10 và IE 11

While working on recent Drupal projects, I learned that Internet 10 and 11 (IE10-11) no longer support IE conditional comments. Conditional comments allow us to target specific versions or version ranges of IE to correct bugs or inconsitentices that normally are not present on other browsers. Typically for IE9 and below, we have been able to write conditional css by using something like this:

<!DOCTYPE html>
<!--[if IE 8 ]> <html class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie9"> <![endif]--> 

The code above allows us to add a css class to the html tag which only becomes available if the browser we are using is one of the ones above (IE 8 or 9). This is extremely helpful because with this class we can now write css styles that only apply to those versions of IE.

>> Hướng dẫn làm No more View pages

>> Thông tin về HTTP với Drupal::httpClient

>> Hướng dẫn Drupal 7 Migration thành Drupal 8

Writing conditional code based on the IE version is never desired but it comes as a necessity to address bugs or correct style inconsistencies between IE and the rest of the browsers.

HOW TO CONDITIONALLY TARGET IE10 AND 11

There is no question that IE10 and 11 are an improvement from previous versions of IE, but unfortunately there are times when they too need special attention. In order to conditionally target IE10 and 11 we can now use a special media query:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    // IE10+ CSS here
}

With the above media query in place you are now ready to conditionally target IE10 and 11. For IE 9 and below, we can continue to use the usual conditional comments.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Google Maps Android Apps Review

Google Maps Android Apps Review

If you like to travel and see the world then you probably understand just how important it is to get your directions right.

Cài đặt Verax NMS trên SuSE, RedHat và Debian

Cài đặt Verax NMS trên SuSE, RedHat và Debian

Verax NMS là một khả năng mở rộng tích hợp các dịch vụ IT đảm bảo giải pháp cho quản lý cross-silos và giám sát hệ thống mạng, trung tâm dữ liệu, các ứng dụng và đám mây.

Hướng dẫn sử dụng Drupal Views and Isotope

Hướng dẫn sử dụng Drupal Views and Isotope

When I was trying to decide how I would lay out my "Recent Work" section for this site, I was intrigued by a style called masonry.

Công ty diệt chuột T&C

 

Diet con trung