What CSS makes <a>
tags show on a single line, rather than under each other?
Maybe have a link in <li>
tag?
Anchor or the HTML <a> element is displayed as inline by default. So that if we have link within our paragraph/text, it will seamlessly blend in. For navigation menu purpose, which consists of links (wrapped in div or ul li or other) we can make the anchors displayed as block elements.
The anchor element tag is the letter “a” surrounded by angle brackets like this: <a>. Both the opening and closing attributes are required, and all of the content between the tags makes up the anchor source.
Remember, only override the display property for anchor element which is placed inside a parent container, not for all anchor element. Find...
This allows you to then reference that anchor with [text] (#my-anchor-name). This functionally works in Typora as it is standard MD, but the issue I have is in how the anchor is displayed. Currently it is recognized as just plain inline html, and unlike <br/> or <p> tags, will always be shown in the displayed text.
I believe you want:
a {
display: block;
}
edit
Anchors by default show inline, but the related CSS is:
a {
display: inline;
}
You could also use inline-block
which gives you a bit more functionality (although some older browsers support it poorly).
I created an example for you which answers your second question.
<p id="top">This is the top of the file</p>
<ul> Favourite sports
<li><a href="http://en.wikipedia.org/wiki/Football">Football</a></li>
<li><a href="http://en.wikipedia.org/wiki/Tennis">Tennis</a></li>
<li><a href="http://en.wikipedia.org/wiki/Rugby_football">Rugby</a></li>
</ul>
<p><a href="#top">This link goes to the top</a></p>
The tag li refers to list item. Links are written the same way in ordered and unordered lists.
If you want a link in a <li>
tag:
<ul>
<li>
<a href="#">Link here.</a>
</li>
</ul>
CSS:
li {
display:inline-block;
}
Example here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With