The justify-self css property is not achieving the intended outcome

justify-self doesn't seem to be functioning properly. Any ideas why?

html

<div class="container">
  <div class="a">

  </div>
  <div class="b">

  </div>
  <div class="b">

  </div>

</div>

css

.container {
  display: flex;
  justify-content: center;
  background: yellow;
}

.container * {
  width: 10px;
  height: 10px;
  background: green;
  border: 2px solid red;
}

.a {
  justify-self: start;
}

jsfiddle

I assumed that the first element with the class a should align to the left since it specifies justify-self: start, but that doesn't happen. Any insights on why this might be?

Comments informed me that flexbox does not support the justify-self property. In that case, how could I use grid to position two children in the middle of the parent and one child to stick to the left side?

Answer №1

Using Flexbox instead of Grid is the solution here.
Flexbox is ideal for one-dimensional layouts, while Grid is better suited for two-dimensional layouts.

There are multiple ways to achieve this. Check out Michael_B's excellent explanation in response to a similar question here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The range filter is exclusive to the initial controller

My range filter (see code below) is only working on my first controller. I have added the same filter to other controllers in the app.js and HTML, but it's not functioning for some reason. I checked the console for errors, but there are none. Here i ...

Only the first cell is affected by the background color setting

... <th style='background-color:#cccccc;font-weight:bold'><td></td><td>Address</td><td>Last Name</td><td>First Name</td><td>ZIP Code</td><td>City</td></th> ...

Tips for adding an active class when a link is clicked

I am working on a Sidebar component and need to apply the active_class_link style to the DIV element when the onClick() event occurs. Although I have set up the function, I am unsure how to apply this for each DIV within my component. The desired behavior ...

Pop-up window for uploading files

Looking for assistance with my file uploading system. I am utilizing a unique purple button from http://tympanus.net/Development/CreativeButtons/ (Scroll down to find the purple buttons). Additionally, I am using a wide, short content popup feature availa ...

Coordinate the timing of CSS animation with the loading of the page

Despite the abundance of similar questions, none have quite addressed my specific query. I've created a preloader using CSS animation and I want it to synchronize perfectly with the page load. While I can trigger the animation on page load, I'm s ...

Having trouble with my Angular application, seems to be stuck at the loading screen. Not sure what's causing it, possibly

Hey there, I'm hoping to create a straightforward app that showcases posts. However, I've encountered an issue when deploying the initial page which is stuck on "Loading...". I believe it's a minor problem and would appreciate your assistan ...

What is the best way to transfer a data string from my HTML document to my server (using either Node or Express) and trigger a specific function with that data?

Currently, my node.js server is operational and successfully creating an excel document by fetching data from an API using Axios. Now, I am looking to implement a feature where users can input a string on my HTML page, which will then be sent to the web se ...

What is the best way to trigger a function when a button is enabled in Angular 8?

Here is a portion of my sign-in.component.html file. I have created a function in the corresponding sign-in.component.ts file that I want to trigger when the button below becomes enabled. Here is an example of what I am trying to achieve: <div class= ...

Guide: Placing two divs with variable widths inside a fixed-width container

Currently, I am working on customizing my subheadings to fit within a 960 grid layout design. The challenge is that the headings need to have a trailing decoration (in this scenario, two lines aligned at the bottom). To achieve this, I created a div for t ...

Turning a string retrieved from the element's data attribute into a JSON format

I am running into an issue with the code snippet below. It seems that $.parseJSON() is having trouble with single and double quotes. I'm stuck on finding a solution to this problem. Any help would be greatly appreciated! <div data-x='{"a":"1" ...

Jquery does not display the variable in the Firefox console using console.log

I am trying to retrieve the data value from the text input, but it's not getting logged in the console. I even tried using a breakpoint, but it still doesn't console anything. What could be the issue? var x = '' $(() => { $("#en ...

A method for aligning two different font sizes vertically within a single <p> element

My question is, how can I vertically align the following: Goal: - - | - | - - Currently, the vertical alignment defaults to baseline. Current Alignment: _ _ | _ | _ _ HTML: <div class="moduleResult"> <p>You have <span class= ...

Creating a dynamic navigation bar that changes based on the current section of a webpage

I have encountered two instances where the navigation bar items automatically get selected when I scroll to a specific section. How can I achieve this? I am looking for an updated solution as of 2018 that is as simple as possible (using vanilla JS or witho ...

What is the process for incorporating a dropdown field and editable field within a container?

Looking to create a unique setup by incorporating dropdown fields and editable text fields within a designated box, similar to the image provided. Any tips on how to successfully implement this design? https://i.sstatic.net/6tGMp.jpg ...

What is the code to make an arrow symbol in CSS that represents 'greater than' symbol?

Can these arrows be created using CSS while maintaining compatibility with all browsers, including IE 6, 7, and 8? Or is using an image the only solution? Home > Products > Digital camera ...

"jQuery's .each() method is only iterating through the last element in

I am encountering an issue with this function not operating correctly... only the last Element shows the box. NOTES: <aside> is set to position: fixed; and I understand that this is not the "correct" use of <article> tags, but it helps me dist ...

Angular 6: A guide to dynamically highlighting navbar elements based on scroll position

I am currently building a single page using Angular 6. The page is quite basic, and my goal is to emphasize the navbar based on scrolling. Below is the code snippet I am working with: .sticky { position: sticky; top: 0; } #i ul { list-style-type: ...

Conceal element when unchecked

There is a checkbox pre-selected labeled "Use profile address" with the address displayed below. If the customer unchecks the checkbox, the address that was shown before will disappear and a new input field for adding a different address will appear. I a ...

Ways to boost CSS transform with GPU acceleration

Is there a way to ensure smooth animations by utilizing GPU acceleration for CSS transforms in browsers? When does this acceleration occur and how can it be forced? For more information, check out this article ...

What is the best way to eliminate excess padding or margin within an absolute block?

I am working on a project where I want to replicate an illustration similar to this one However, I am encountering an issue with the padding or margin. Here is what I have attempted so far: http://jsfiddle.net/kl94/RZPRS/2/ .circles { background-colo ...