Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to vertically align elements inside GitHub Markdown?

How can I vertically align the image and text in the image below?

image followed by misaligned text

This is the way I’m writing it in my Markdown:

<a name="version"></a>[ ![Download](https://api.bintray.com/packages/edsilfer/maven/search-interface/images/download.svg) ](https://bintray.com/edsilfer/maven/search-interface/_latestVersion) - **MIN API VERSION: 16**
like image 964
E. Fernandes Avatar asked Nov 30 '16 01:11

E. Fernandes


People also ask

How do you align items in markdown?

To center images, text, and anything else in Github markdown and READMEs simply wrap the element in an HTML tag with the align attribute set to "center" .

How do I change alignment in markdown?

Aligning text in native markdown is not possible. However, you can align the text using inline HTML tags. To justify, replace right with justify in the above. It works, but it breaks links like <div style="text-align: right"> [up](https://github.com/loretoparisi/CapsNet#CapsNet) </div> will be not rendered as a link.

How do you align block elements vertically?

When the element to be centered is an inline element we use text-align center on its parent. When the element is a block level element we give it a width and set the left and right margins to a value of auto. With text-align: center in mind, most people look first to vertical-align in order to center things vertically.

How do I center align an image in markdown?

Solution 2 : use the "align" deprecated attribute This is not recommended, but in some cases this is the only way to center the image. Insert this HTML snippet into your markdown file. You can also try to put the "align" attribute directly into the "img" tag.


1 Answers

I can think of 2 workarounds to this issue

  1. create an image with all the text (Download 1.0.0 - MIN API 16)
  2. use html for this block (ex. <table><tr><td valign="center"><img ...> text </td></tr></table>)

may not the best way, but it is an improvement :)

like image 86
Ofer Skulsky Avatar answered Sep 21 '22 21:09

Ofer Skulsky