问题
nav ul:after {
content:"";
clear:both;
display:block;
}
What does the ""
value mean on the content property?
回答1:
It's just a clearfix, which means, if your ul
elements have floated li
, than they will be self cleared, it just behaves similar to overflow: hidden;
but unlike overflow: hidden;
it wont hide the overflowing content.
Demo (Without clearfix)
Demo 2 (With clearfix)
And why you need to clear
and what you need to clear, for that, you can refer my answer here
As you edited your question, content property is used with :before
or :after
pseudo to embed virtual content on the page, so using content: "";
means just blank, you are not embedding any character in your page.
来源:https://stackoverflow.com/questions/20845014/what-does-an-empty-value-for-the-css-property-content-do