I am trying to learn CSS and occasionally in coming across coding samples, I stumble upon code I haven’t learned in depth before. So I am basically confused by this code and google did not give me enough info.
I would do some research. If I google “css after”, I get led here. (MDN is a great resource by the way.) The first paragraph there explains what the “content” is.
A good developer is a good engineer. And a good engineer is someone that enjoys taking things apart and seeing how they work. Why not mess around with these things and see what they do? Just start with at content attribute, put a value in there, and see what it does. They give some examples - why not copy them into an editor and mess with them?
The display and clear attribute work are just CSS attributes you can google and should work the same for pseudo-elements.
In addition to MDN, I find css-tricks to be a useful site.
Elements after a floating element will flow around it. Use the “clearfix” hack to fix it.
Think of it as a virtual element which will create an empty element for you before your parent element ends. This will self clear your row class element holding floated elements. This element won’t exist in your DOM literally but will do the job.
search clearfix on any preferred search engine you will find detailed explanations.
Please refer this stackoverflow link to get better understanding:
Although knowing about how float works isn’t a bad idea, I also wouldn’t worry too much about it. Using float to do layout is an outdated approach. If you learn flexbox and grid you do not need to use float and will avoid all the pitfalls of using it. Whenever possible, the parent container should be responsible for laying out its children.
I’d suggest using float primarily for its intended purpose, which is floating text around an element.