_alignment.scss 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //FRONTEND
  2. .wp-site-blocks { // top level of the view
  3. //In this situation we want to introduce a standardized gap between content and the edge of the screen.
  4. padding-left: var(--wp--custom--gap--horizontal);
  5. padding-right: var(--wp--custom--gap--horizontal);
  6. .alignfull {
  7. // these elements we want to "bust out" of the gap created above
  8. margin-left: calc(-1 * var(--wp--custom--gap--horizontal)) !important;
  9. margin-right: calc(-1 * var(--wp--custom--gap--horizontal)) !important;
  10. width: unset;
  11. // however any containers that "bust out" should re-apply that gap but this time using padding instead of margins.
  12. &.wp-block-template-part,
  13. &.wp-block-columns,
  14. &.wp-block-group {
  15. padding-left: var(--wp--custom--gap--horizontal);
  16. padding-right: var(--wp--custom--gap--horizontal);
  17. }
  18. }
  19. }
  20. // EDITOR (NOTE: It PROBABLY would be OK to bring these together to "simplify" the stylesheet. However the selectors are quite different
  21. // and it's a lot easier to understand and ensure intent separated in this way.
  22. .is-root-container { //top level of the editor
  23. padding-left: var(--wp--custom--gap--horizontal);
  24. padding-right: var(--wp--custom--gap--horizontal);
  25. .wp-block[data-align="full"] { //blocks configured to be "align full" in "editorspeak"
  26. margin-left: calc(-1 * var(--wp--custom--gap--horizontal)) !important;
  27. margin-right: calc(-1 * var(--wp--custom--gap--horizontal)) !important;
  28. width: unset;
  29. >.wp-block-group {
  30. padding-left: var(--wp--custom--gap--horizontal);
  31. padding-right: var(--wp--custom--gap--horizontal);
  32. }
  33. }
  34. }
  35. @include break-mobile {
  36. // limit size of any element that is aligned left/right
  37. .wp-block[data-align="left"], // This is for the editor
  38. .wp-block[data-align="right"], // This is for the editor
  39. .wp-site-blocks .alignleft,
  40. .wp-site-blocks .alignright {
  41. max-width: var(--wp--custom--alignment--aligned-max-width);
  42. }
  43. }
  44. // This was added for the 'site-logo' block which centers with an 'align:center' attribute
  45. // instead of 'textAlign' center which sets an .aligncenter class instead of a has-text-align-center
  46. // class which would do this for us. I'm not sure why but this centers things appropriately.
  47. // Display and margin properties added to support image alignment from the classic editor.
  48. .aligncenter {
  49. text-align: center;
  50. display: block;
  51. margin-right: auto;
  52. margin-left: auto;
  53. }