You can't legislate: morality, common sense, good manners, and consideration for others.
You can try, but it will have no effect on reality. We have a plethora of local, state, and federal laws, both current and failed, as examples.
These are things that must be taught, and more often than not it seems they are not.