HTML structure help please

Author
Khadija Rahman Author
|
14 hours ago Asked
|
5 Views
|
0 Replies
0

hey folks, i'm totally new to frontend stuff and trying to build my very first simple webpage. i'm just trying to get some text and images to show up properly.

i'm really struggling with the very basic HTML structure. things aren't appearing where i expect them to, especially when i try to nest elements. it's kinda frustrating when i think something should be next to another thing, but it just stacks on top.

for example, i was playing around with this:


<!DOCTYPE html>
<html>
<head>
    <title>My First Page</title>
</head>
<body>
    <div>Hello World!</div>
    <p>This is a paragragh.</p>
    <span>And this is a span.</span>
    <div><p>Another div with nested p</p></div>
</body>
</html>

i thought maybe the span would show up right after the paragragh on the same line, but it just goes to a new line. also, when i put a <p> inside a <div>, it seems to add extra space. what are the fundamental rules for how elements like div, p, and span interact and how they affect the layout? how do i properly structure basic HTML for predictable results?

help a brother out please...

0 Answers

No answers yet.

Be the first to provide a helpful answer!

Your Answer

You must Log In to post an answer and earn reputation.