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

 
Những vấn đề basic của Drupal 8 tại DrupalCon Austin

Những vấn đề basic của Drupal 8 tại DrupalCon Austin

To figure that out, I've mined the schedule for Drupal 8 related talks and events and organized them a bit to help me – and hopefully you – find the Drupal 8 sessions not to be missed.

Open AI View cho AI Camera tại Diễn đàn Công nghệ VnExpress 2021

Open AI View cho AI Camera tại Diễn đàn Công nghệ VnExpress 2021

Theo ông Vũ Thanh Thắng, chúng ta đang xây dựng một thành phố thông minh và để các hệ thống thông minh hoạt động được, cần có số lượng camera lớn.

Scala

Web framework và web server Xitrum cho Scala do người Việt viết

Xitrum vừa là web framework vừa là web server mã nguồn mở theo phong cách hiện đại viết bằng Scala, cho Scala, có những tính năng nổi bật sau:

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

 

Diet con trung