We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
::before
::after
高级
<a href="https://cdn.xgqfrms.xyz/logo/icon.png" class="logo"></a>
a::before { box-sizing: border-box; display: block; width: 300px; height: 300px; font-size: 37px; font-weight: bold; color: #000; padding-top: 30px; text-align: center; content: "xgqfrms's logo"; background: url('https://cdn.xgqfrms.xyz/logo/icon.png') no-repeat; }
const dom = document.querySelector('a'); const url = getComputedStyle(dom, ':before').getPropertyValue('background-image'); console.log(`::before url =`, url); /* "::before url =" "url('https://cdn.xgqfrms.xyz/logo/icon.png')" */
https://codepen.io/xgqfrms/pen/OJvojyJ
https://stackoverflow.com/questions/44342065/how-to-get-a-dom-elements-before-content-with-javascript
The text was updated successfully, but these errors were encountered:
No branches or pull requests
前端面试题集: No.0001 使用 js 对 CSS 的
::before
&::after
伪元素进行操作试题难度
高级
考察点
demo
codepen live demo
https://codepen.io/xgqfrms/pen/OJvojyJ
试题来源/试题出处
https://stackoverflow.com/questions/44342065/how-to-get-a-dom-elements-before-content-with-javascript
The text was updated successfully, but these errors were encountered: