Remove Spaces

As you can see in the picture there is a big margin I want to remove that.
35 Replies
rig26.
rig26.OP3y ago
my code haha
rig26.
rig26.OP3y ago
~MARSMAN~
~MARSMAN~3y ago
justify-content: space-between:
justify-content: space-between:
It gives an equal gap or empty space between the child elements of this container.
rig26.
rig26.OP3y ago
rig26.
rig26.OP3y ago
this is the structure of html
~MARSMAN~
~MARSMAN~3y ago
justify-content - CSS: Cascading Style Sheets | MDN
The CSS justify-content property defines how the browser distributes space between and around content items along the main-axis of a flex container, and the inline axis of a grid container.
~MARSMAN~
~MARSMAN~3y ago
Check this for more info about justify-content values
Mannix
Mannix3y ago
adds space himself asks how to remove it 😁
Jochem
Jochem3y ago
you shouldn't nest P tags it probably doesn't matter for the problem, but it's the wrong way to use that tag well, actually, cause you aren't allowed to nest them, it's probably doing messy things in the DOM
<p> some text
<p> some more text
<p> some text
<p> some more text
is equivalent to
<p>some test</p>
<p>some more text</p>
<p>some test</p>
<p>some more text</p>
since whitespace is irrelevant to document structure in HTML, your <p>Company:<p></p></p> is actually equivalent to <p>Company:</p><p></p>
rig26.
rig26.OP3y ago
so what css should I do now
rig26.
rig26.OP3y ago
Jochem
Jochem3y ago
if you post your code as text, I can copy/paste and edit it in a code block please
rig26.
rig26.OP3y ago
.flex { display: flex; flex-direction: row; justify-content: flex-start; } .flex p{ flex-grow: 1; } I am trying to grow it to balance
Jochem
Jochem3y ago
the HTML, there's nothing wrong with the CSS
rig26.
rig26.OP3y ago
I dont know how
~MARSMAN~
~MARSMAN~3y ago
How do you want them to look like?
Jochem
Jochem3y ago
```html to open, ``` to close, both on their own lines, and your code in between
rig26.
rig26.OP3y ago
<div class="flex"> <p>Company:</p><p id="company-name"></p>
<p>Remaining Seats:</p><p id="remaining-seats"></p> I want to have a cleaner look less space from the Company : and Remaining Seats It looks ugly because the amount of space is too much
~MARSMAN~
~MARSMAN~3y ago
So you want a space between the company and the remaining seats only, right?
rig26.
rig26.OP3y ago
yes like this
rig26.
rig26.OP3y ago
rig26.
rig26.OP3y ago
but I Manually input it to a p tag
~MARSMAN~
~MARSMAN~3y ago
Do what Jochem says, your HTML is wrong and causing it to do this
rig26.
rig26.OP3y ago
yes I did
Jochem
Jochem3y ago
wrap label and value together in a div that way the flex will treat them as a single unit, and it'll put the space between the two units (of company and remaining seats)
Mannix
Mannix3y ago
i would use ul li not p here
rig26.
rig26.OP3y ago
rig26.
rig26.OP3y ago
I follow your instruction XD
Jochem
Jochem3y ago
can I ask why you didn't make a codepen? Out of curiosity
rig26.
rig26.OP3y ago
ul li? okay I'm gonna create now
Mannix
Mannix3y ago
<div>
<ul class="flex">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div>
<ul class="flex">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
Jochem
Jochem3y ago
I'd take that one further:
<div>
<ul class="flex">
<li>Company: <span id="company-name"></span></li>
<li>Remaining seats: <span id="remaining-seats"></span></li>
</ul>
</div>
<div>
<ul class="flex">
<li>Company: <span id="company-name"></span></li>
<li>Remaining seats: <span id="remaining-seats"></span></li>
</ul>
</div>
You'd lose some of the ability to style the distance between the label and the value, but it's much simpler HTML and that styling doesn't seem to be wanted in this case anyway
rig26.
rig26.OP3y ago
rig26.
rig26.OP3y ago
I dont understand why it behave like this btw the id in span are dynamic I mean the values
~MARSMAN~
~MARSMAN~3y ago
Do a code pen
Want results from more Discord servers?
Add your server