FAQ: CSS Display and Positioning - Inline-Block Display

This community-built FAQ covers the “Inline-Block Display” exercise from the lesson “CSS Display and Positioning”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn CSS

FAQs on the exercise Inline-Block Display

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Why did the bullets for the list items disappear once they were changed to inline-block?

Are there any elements that are automatically inline-block? Or are all elements inline -OR- block and then setting the element to inline-block in CSS gives it the attributes of both?

1 Like

Yeah, The bullets for the list disappeared… Any explanations?

Inline blocks are a non-standard list presentation with, list-style-type: none; The bullets, margin and padding are part of list-style, so once that property is removed, only the list item textContent remains.

Doubful, there are any. It is an arbitrary property set by the designer. Elements are either block, so take the full width of the view point, or inline so they have no defined width, hence occur inline in normal flow.

In the inline-block lesson we were told " Images are the best example of default inline-block elements."
yet now you say you doubt there are any default inline-block elements. Please explain.

IMG has always been an inline element. On further testing, it would appear so, since there is no gap between them in the page when they are written inline.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>images inline vs inline-block</title>
</head>
<body>
<img src="image00222.jpg"><img src="image00222.jpg"><img src="image00222.jpg">
</body>
</html>

inline_img

If they were inline-blocks they would have a two or more pixel gap between them. It is my understanding that inline-blocks have that gap by default.

<img> is a replaced element; it has a display value of inline by default, …
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img