Skip to content

Instantly share code, notes, and snippets.

@hellofromtonya
Created July 24, 2018 00:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellofromtonya/a5d0729f418956c2546b6537b225e003 to your computer and use it in GitHub Desktop.
Save hellofromtonya/a5d0729f418956c2546b6537b225e003 to your computer and use it in GitHub Desktop.
Post Content -> Wide Image Alignments with Gutenberg Image Blocks
<!-- wp:paragraph -->
<p>Welcome to image alignment! The best way to demonstrate the ebb and flow of the various image positioning options is to nestle them snuggly among an ocean of words. Grab a paddle and let's get started.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>On the topic of alignment, it should be noted that users can choose from the options of <em>None</em>, <em>Left</em>, <em>Right, </em>and <em>Center</em>. In addition, they also get the options of <em>Thumbnail</em>, <em>Medium</em>, <em>Large</em> &amp; <em>Fullsize</em>.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>The image below happens to be a full sized, <em><strong>centered</strong></em><strong> Gutenberg Image Block.</strong></p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":967,"align":"center"} -->
<figure class="wp-block-image aligncenter"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-580x300.jpg" alt="Image Alignment 580x300" class="wp-image-967"/></figure>
<!-- /wp:image -->
<!-- wp:image {"id":968,"align":"left"} -->
<figure class="wp-block-image alignleft"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-150x150.jpg" alt="Image Alignment 150x150" class="wp-image-968"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"align":"left"} -->
<p style="text-align:left">The rest of this paragraph is filler for the sake of seeing the text wrap around the 150x150 image, which is <em><strong>left aligned</strong></em>.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>As you can see the should be some space above, below, and to the right of the image. The text should not be creeping on the image. Creeping is just not right. Images need breathing room too. Let them speak like you words. Let them do their jobs without any hassle from the text. In about one more sentence here, we'll see that the text moves from the right of the image down below the image in seamless transition. Again, letting the do it's thang. Mission accomplished!</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>And now for a <em><strong>massively large image</strong></em>. It also has <em><strong>no alignment</strong></em>.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":1029} -->
<figure class="wp-block-image"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-1200x4002.jpg" alt="Image Alignment 1200x4002" class="wp-image-1029"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>The image above, though 1200px wide, should not overflow the content area. It should remain contained with no visible disruption to the flow of content.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":1025,"align":"right"} -->
<figure class="wp-block-image alignright"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-300x200.jpg" alt="Image Alignment 300x200" class="wp-image-1025"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>And now we're going to shift things to the <em><strong>right align</strong></em>. Again, there should  be plenty of room above, below, and to the left of the image. Just look at him there... Hey guy! Way to rock that right side. I don't care what the left aligned image says, you look great. Don't let anyone else tell you differently. </p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>In just a bit here, you should see the text start to wrap below the right aligned image and settle in nicely. There should still be plenty of room and everything should be sitting pretty. Yeah… Just like that. It never felt so good to be right.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>And just when you thought we were done, we're going to do them all over again with captions!</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":967,"align":"center"} -->
<figure class="wp-block-image aligncenter"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-580x300.jpg" alt="Image Alignment 580x300" class="wp-image-967"/><figcaption>Look at 580x300 getting some <a title="Image Settings" href="https://en.support.wordpress.com/images/image-settings/">caption</a> love.</figcaption></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>The image above happens to be <em><strong>centered</strong></em>. The caption also has a link in it, just to see if it does anything funky.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":968,"align":"left"} -->
<figure class="wp-block-image alignleft"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-150x150.jpg" alt="Image Alignment 150x150" class="wp-image-968"/><figcaption>Itty-bitty caption.</figcaption></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>The rest of this paragraph is filler for the sake of seeing the text wrap around the 150x150 image, which is <em><strong>left aligned</strong></em>.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>As you can see the should be some space above, below, and to the right of the image. The text should not be creeping on the image. Creeping is just not right. Images need breathing room too. Let them speak like you words. Let them do their jobs without any hassle from the text. In about one more sentence here, we'll see that the text moves from the right of the image down below the image in seamless transition. Again, letting the do it's thang. Mission accomplished!</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>And now for a <em><strong>massively large image</strong></em>. It also has <em><strong>no alignment</strong></em>.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":1029} -->
<figure class="wp-block-image"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-1200x4002.jpg" alt="Image Alignment 1200x4002" class="wp-image-1029"/><figcaption>Massive image comment for your eyeballs.</figcaption></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>The image above, though 1200px wide, should not overflow the content area. It should remain contained with no visible disruption to the flow of content.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":1025,"align":"right"} -->
<figure class="wp-block-image alignright"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-300x200.jpg" alt="Image Alignment 300x200" class="wp-image-1025"/><figcaption>Feels good to be right all the time.</figcaption></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>And now we're going to shift things to the <em><strong>right align</strong></em>. Again, there should be plenty of room above, below, and to the left of the image. Just look at him there… Hey guy! Way to rock that right side. I don't care what the left aligned image says, you look great. Don't let anyone else tell you differently.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>In just a bit here, you should see the text start to wrap below the right aligned image and settle in nicely. There should still be plenty of room and everything should be sitting pretty. Yeah… Just like that. It never felt so good to be right.</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":1029,"align":"center"} -->
<figure class="wp-block-image aligncenter"><img src="https://amp-wp.test/wp-content/uploads/2013/03/image-alignment-1200x4002.jpg" alt="Image Alignment 1200x4002" class="wp-image-1029"/><figcaption>Huge image that is center aligned.</figcaption></figure>
<!-- /wp:image -->
<!-- wp:paragraph -->
<p>And that's a wrap, yo! You survived the tumultuous waters of alignment. Image alignment achievement unlocked! One last thing: The last item in this post's content is a thumbnail floated right. Make sure any elements after the content are clearing properly</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":827,"align":"right"} -->
<figure class="wp-block-image alignright"><img src="https://amp-wp.test/wp-content/uploads/2012/07/manhattansummer-150x150.jpg" alt="" class="wp-image-827"/></figure>
<!-- /wp:image -->
@hellofromtonya
Copy link
Author

Converts Markup: Image Alignment post (i.e. from the import of the WordPress theme's unit test data) into Gutenberg paragraph and image blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment