Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to align div components in one line?

The result I want looks like this

enter image description here

What I have currently

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

So all I want is the tag to be immediately after the title line. This small issue is one I am struggling

Relevant part of Render statement

<div className="headtitle">
              {items.product.name}
              <div className="flexbox-item-tag">{items.product.tags}</div>
            </div>

Items.product.name is the main title containing the drone title.
Items.product.tag is the tag that must follow the title

The css for the headtitle div which contains the title and tag.

.headtitle {
  color: #333333;
  font-family: 'Roboto';
  font-size: 16px;
  line-height: 24px;
  width: 526px;
  text-align: left;
  margin-top: 0px;
  flex-wrap: wrap;
}

The tags class and styling css

.flexbox-item-tag {
  align-self: flex-start;
  background-color: rgba(196, 193, 193, 0.274);
  border: #333333;
  font-size: 12px;
  color: #999999;
  width: 111px;
  height: 20px;
  text-align: center;
  line-height: 20px;
}

enter image description here

>Solution :

.flexbox-item-tag should be set as display: inline-block.

The element is a div, therefore its default display is block which means it will render on its own "row", "below" the previous element, as shown in your example.

Note that you’ve set align-self on the .flexbox-item-tag element, which cannot work without the parent element being set as flexbox.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading