<!DOCTYPE html> <html> <head> <style> div.one.two{ width:200px; height:200px; background-color:lightblue; border:1px solid red; } div.one .two{ width:150px; height:150px; background-color:lightgreen; } </style> </head> <body> <div class="one two">It has two classes.</div> <div class="one">It has one class but there is no difference.</div> <div class="one"> <p class="two">This is a paragraph with parent that has one as the attribute of class.</p> </div> </body> </html><!DOCTYPE html> <html> <head> <style> div.one.two{ width:200px; height:200px; background-color:lightblue; border:1px solid red; } </style> </head> <body> <div class="one two">It has two classes.</div> <div class="one">It has one class but there is no difference.</div> </body> </html>
Run
×
Share