I want to make each one of these element is different line, without using <br />
in HTML, <h1>
is block element but I have to fix its width
. How can I make anchors come under <h1>
not beside?
<h1 id="viewerTitle">Header </h1>
<a href="#" class="view-options">View options</a>
<a href="#" class="view-options">View options</a>
Here's an example: http://jsfiddle.net/mmhhd/
Instead of using the <br> tag, you should use a semantic HTML element and the CSS margin or padding properties if necessary.
Note: Use the <br> tag to enter line breaks, not to add space between paragraphs.
Learn HTML In HTML, the <br> tag is used for line break. It is an empty tag i.e. no need to add an end tag. Writing <br> tag is perfectly fine.
Start by removing float: left
from h1
.
Then add the rule:
a.view-options {
display: block;
}
Alternative way:
Remove float:left;
in h1
and display: inline-block;
in a.view-options
Then add
h1:after, a:after {
content:"\a";
white-space: pre;
}
See http://jsfiddle.net/8my6q/
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