text-transform: uppercase causes layout error on Chrome

后端 未结 2 453
北海茫月
北海茫月 2020-12-18 14:27

I\'ve run across a strange layout bug that appears to be triggered by the text-transform CSS property when an inline-block is nested within a

2条回答
  •  [愿得一人]
    2020-12-18 15:05

    There seem to be a kind of race condition in the loading of css. The following file reproduces the bug here on Chrome (17.0.963.65) on osx 10.6.8.

    
    
      
        
        Schizophrenic layout 
        
        
      
      
        

    Note that the bug is present even if gray.png is not a 404. You may have to reload the page a few time to witness the bug. Also if you don't GET the file over http, the bug shows only once, the first time you load the page from the disk.

    There are various ways to make the bug disappear by tweaking the css. Removing only the background-image makes it disappear. Removing only the display makes it disappear. Removing only the two text-transform make it disapear. In the latter case the correct layout can be achieved by adding

         e.style.textTransform = "uppercase";
    

    at the end of the fill function which is, of course, a very ugly workaround.

提交回复
热议问题