CSS 内容 属性 在 chrome console.log 中显示方框字符,为什么不显示文本?
CSS content property is displaying a box character in chrome console.log, why not text?
我现在正在使用我制作的自定义图标字体。只是尝试一些东西,我得到了这个。我有我的 style-sheet 文件,其中我所有的字体及其各自的内容 属性 及其值如 .assassin_creed:before {content: "\e018";}
在 chrome 控制台中看到这个 class 它给了我类似 .assassin_creed::before {content: "";}
的东西
为什么我得到这个框而不是内容值?我怎样才能在 chrome 控制台的文本中检索它的值??
Its a invalid escaped unicode
string, so its showing the Box thats even box will be displayed, if you use Chinese fonts which is not loaded in your browser.
访问属性 JS中的值:
var assassin_creed = document.querySelector('.assassin_creed'),
result = getComputedStyle(assassin_creed, ':before').content;
console.log('the generated content is: ', result); // returns '\e018'
尝试如下以更好地理解:
.assassin_creed:before {
content: '>[=11=]00a0';
}
类似问题:
参考内容CSS 属性更好理解:
https://developer.mozilla.org/en/docs/Web/CSS/content
http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_before
Adding HTML entities using CSS content
我现在正在使用我制作的自定义图标字体。只是尝试一些东西,我得到了这个。我有我的 style-sheet 文件,其中我所有的字体及其各自的内容 属性 及其值如 .assassin_creed:before {content: "\e018";}
在 chrome 控制台中看到这个 class 它给了我类似 .assassin_creed::before {content: "";}
的东西
为什么我得到这个框而不是内容值?我怎样才能在 chrome 控制台的文本中检索它的值??
Its a invalid
escaped unicode
string, so its showing the Box thats even box will be displayed, if you use Chinese fonts which is not loaded in your browser.
访问属性 JS中的值:
var assassin_creed = document.querySelector('.assassin_creed'),
result = getComputedStyle(assassin_creed, ':before').content;
console.log('the generated content is: ', result); // returns '\e018'
尝试如下以更好地理解:
.assassin_creed:before {
content: '>[=11=]00a0';
}
类似问题:
参考内容CSS 属性更好理解:
https://developer.mozilla.org/en/docs/Web/CSS/content
http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_before
Adding HTML entities using CSS content