A yellow card in football is given for a gross violation of the rules, unsportsmanlike behavior. You can also get a yellow card for systematic violation of the rules. That is, if a player often fouls, the referee, based on the totality of these fouls, can give the LCD even for a non-gross violation.
A yellow card is given for a violation of the rules of the game (foul play, simulation in the game, violation of the rules when scoring chances, blow before the whistle, wasting time, for unsportsmanlike behavior or an argument with a referee).
All the rules of football are enshrined in a document that is published annually by the International Council of Football Associations. In the latest version of Laws of the Game 2018/19, rule 12 lists every possible reason for warnings to players:
The last two points are new this season. In addition, players are warned who endanger, provoke or insult fans to celebrate a goal, cover their faces with a mask or a T-shirt, or take off their shirt.
For breaking the rules. At the same time, the penalties for violation of the rules differ: for not being rude - a free kick, for rude - a free kick and a yellow card, for a particularly rude or last resort foul - a free kick and a red card.