Jump to content

I want 2 of my h tags on the same line

Joshcanread

I want two tags on the same line because i'm writing "Total Price" and then the actual price but it doesn't look good when divided on two lines like this

heres my code 

<h2> Total price </h2>
  <h1 id="TOTALofthings"/>

"total of things" is just 200

 image.png.47126645bbbabd752dfd736f6d296fb7.png

 

i want it to look like this 

image.png.b4f1f6bd131a0bc093b032509912c135.png

Link to comment
Share on other sites

Link to post
Share on other sites

Don't use headers for content like this. Use <p> tags and separate <span> tags as necessary.

 

EDIT: Since I believe you're using header tags for styling, you should learn how to style HTML:  

https://www.w3schools.com/html/html_styles.asp (this method is discouraged, but for the sake of having it)

https://codeburst.io/how-to-style-your-website-with-css-e72e7046fda5

https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Styling_HTML_forms

 

Link to comment
Share on other sites

Link to post
Share on other sites

<h2 style="float:left;"> Total price </h2>
<h1 style="float:left;" id="TOTALofthings"/>

The super ugly way, but it works...

Link to comment
Share on other sites

Link to post
Share on other sites

<h2 style="display:inline">Total price </h2><h1 style="display:inline"/>

Should also work.

But I would use a separate CSS-File for the styling

Link to comment
Share on other sites

Link to post
Share on other sites

<style>
h2 

{

display: inline-block;

}
</style>

add this into html, at the end of the page. 

Basicly everyone gave you same solution with different ways of implementing it. 
2 of those solution inserted style in tags itself with attribute "style"

i added separate way of inserting style of elements in tags outside.

And best way is to include *.css file. best way is to name it style.css

You can add it like this

 

<head>

<link rel='stylesheet' href='style.css' >
</head>

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×