i have a header and a below that i have sentence in a
tag. The below given is the code.
<!DOCTYPE html>
<html>
<body>
<h1>The p element</h1>
<p>This is a paragraph.</p>
</body>
</html>
The above code gives gives me the below result:
The p element
This is a paragraph.
My expected result is:
The p element This is a paragraph.
i also don't want to change the <h>
and <p>
tags
CodePudding user response:
Adding CSS would do the magic. Here is an example:
<!DOCTYPE html>
<html>
<style>
.headline h1, .headline p {
display: inline;
}
</style>
<body>
<div >
<h1>The p element</h1>
<p>This is a paragraph.</p>
</div>
</body>
</html>
CodePudding user response:
Try applying the display: inline
property.
EDIT
You would apply it to both elements:
<h1 style="display:inline">The p element</h1>
<p style="display:inline">This is a paragraph.</p>
Or, using CSS:
p, h1 {
display: inline;
}