margin-shorthand.html (1087B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS basic box model: margin sets longhands</title> 6 <link rel="help" href="https://drafts.csswg.org/css-box-3/#propdef-margin"> 7 <meta name="assert" content="margin supports the full grammar '<length-percentage>{1,4}'."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/shorthand-testcommon.js"></script> 11 </head> 12 <body> 13 <script> 14 test_shorthand_value('margin', '1px 2px 3px 4px', { 15 'margin-top': '1px', 16 'margin-right': '2px', 17 'margin-bottom': '3px', 18 'margin-left': '4px' 19 }); 20 21 test_shorthand_value('margin', '1px 2px 3px', { 22 'margin-top': '1px', 23 'margin-right': '2px', 24 'margin-bottom': '3px', 25 'margin-left': '2px' 26 }); 27 28 test_shorthand_value('margin', '1px 2px', { 29 'margin-top': '1px', 30 'margin-right': '2px', 31 'margin-bottom': '1px', 32 'margin-left': '2px' 33 }); 34 35 test_shorthand_value('margin', '1px', { 36 'margin-top': '1px', 37 'margin-right': '1px', 38 'margin-bottom': '1px', 39 'margin-left': '1px' 40 }); 41 </script> 42 </body> 43 </html>