Showcase a selection of items in a flexbox positioned vertically as a row

Check out my flexbox item and how it appears here

This is the html code:

<div id="property">
              <div style="background-color:coral;"><img :src="item.property_image" width="200px" height="200px" /></div>
              <div class="grow-this" style="background-color:lightblue;"><h3 class="mt item-element">{{item.property_name}} {{item.property_star_rating}}</h3>
              <a href="" class="item-element">here street</a><a href="" class="item-element">Show On Map</a><a href="" class="item-element">2.7km from centre</a></div>
              <div style="background-color:lightgrey;">E</div>
              <div style="background-color:lightgreen;">Very Good</div>
            </div>

Here's the corresponding css:

#property {
  width: 100% !important;
  height: 200px;
  border: 1px solid #c3c3c3;
  display: flex;
  flex-flow: row;
}

#property div {
  flex-basis: 200px;
  height: 200px;
}
.mt{
margin-top:0px;
}
.grow-this{
flex-direction:column;
display: flex;
flex-grow: 1 !important;
}

.item-element{
margin-left:1% !important;
flex-flow: row;
}

I'm trying to make links inside .grow-this appear horizontally, but they are stacking vertically instead of in a row. I've already tried changing the flex-direction, but it's not working.

flex-direction:row;

Any suggestions on how can I get these links to align horizontally?

Answer №1

To change the layout of .item-element from a column to a row, you should set the parent container to have flex-direction: row instead of using flex-flow: row;. This is because when an element has display: flex; applied, the default value for flex-direction is already row. Simply remove flex-direction: column; from .grow-this and the children will display in a horizontal row:

https://jsfiddle.net/sm36ovxb/1/

If you prefer .grow-this to be displayed as a column but want the links to be shown next to each other within a nested row, you can wrap them in another <div> (or a <ul>) and set it to a flex row like this:

https://jsfiddle.net/xgpvmqo9/

Answer №2

Give this a shot: flex-flow: row wrap;

#product {
  width: 100% !important;
  height: 300px;
  border: 2px solid #d5d5d5;
  display: flex;
  flex-flow: row wrap;
  justify-content:space-around;
}

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

JavaScript dropdown menu that dynamically changes colors

<!DOCTYPE html> <html> <head> </head> <body> <script> var redtoggle=false; function togglered() { redtoggle = !redtoggle; if (redtoggle) { document.getElementById("txtInput").style.color = "red"; } else { do ...

The left border is failing to appear on the Td element

When attempting to add border styling to td elements, the left border is not displaying correctly. This issue seems to vary across different browsers. Here is the HTML code: <table class="table-bordered"> <thead> <tr> ...

The card-footer in Bootstrap 4 is not correctly aligned at the bottom of the page

I am currently encountering an issue with the alignment of the 'card-footer' class in Bootstrap 4 cards, as it is not aligning properly at the bottom of the page. If you would like to see the problem for yourself, here is the link to the JS Fidd ...

Change when the mouse departs

I am currently working on implementing a transition effect. My block consists of 3 main parts: Base block Hover image (coming from the top) Hover title (coming from the bottom) When hovering the mouse, there is also a background-color transition that o ...

What are the steps to clipping a canvas using CSS clip-path?

When it comes to clipping a canvas, there are multiple methods that can be used. One way is to create a path with getContext('2d') and set globalCompositeOperation. Another method involves using -webkit-clip-path or clip-path, though the latter m ...

I am struggling to prevent the background image from endlessly repeating despite my best coding efforts

I am struggling to correctly write the code to display the background image in this page only once, without repeating, and centered about 500px down the page. I tried something like "background-image: norepeat" but it didn't work. I looked at the W3C ...

CSS3 blending modes

I am attempting to create a design similar to this letter on an image using blending modes. Check out my code example <div id="box"> <div id="image"> <img src="https://www.epicurrence.com/images/speakers/julie.jpg" /> </div&g ...

Include a border around the list items within two separate columns

I am trying to create 2 columns using li and want to add borders to each of them. However, I'm facing an issue where there are double borders for 2 li. This is the code snippet I have tried: .ul1 { column-count: 2; column-gap: 0px; } .li1 ...

Incorporating ASP.NET server-side functionality with HTML5 for dynamic client-side 2D rendering

Currently working on a project that is about to begin, seeking advice and suggestions for available options. The main objective is allowing users to draw shapes like polygons while the server performs calculations based on various properties of these shap ...

How to set a default value different from the available options using jQuery

<select id="itemDepartment"> <option value="1">Computer Accessories</option> <option value="2">Laptop</option> </select> the default value in the drop-down list can be set using the selected="selected" attribute. ...

Mysterious failure of JavaScript regular expression when encountering the term "tennis"

We developed a JavaScript script to detect duplicates or potential duplicates, but it seems to have some issues with certain words like "tennis." The script functions correctly in most cases, but fails when analyzing phrases related to the word "tennis" fo ...

Attempting to Create a New User and Display the Resulting Page Using JavaScript and Handlebars Templates

I've implemented a form that allows users to input data. https://i.sstatic.net/prh11.png Once the user hits "Add User", they are successfully added to the database. However, instead of transitioning to the next page as expected, the form remains popu ...

Collapsed ReactJS: Techniques for compressing the Material UI TreeView following expansion

My issue involves a Material UI treeView. After expanding it, an API call is made, but the node in the treeView remains open. I have attempted to use onNodeToggle without success. Below is my code: <TreeView className={classes.root1} defaultExpandI ...

What is the best way to ensure that my theme button changer has an impact on all pages throughout my website, not only on the

Looking for some help here - I've got a button that changes the theme/colour of my website, but it only seems to work on the homepage and not on any other pages. Anyone know how I can fix this issue? Here's the JavaScript code: $(document).ready ...

Enhancing xhtml with rich snippets and incorporating microdata for game data

When it comes to rich snippets, are they only for HTML5 or can they also be used in XHTML? My website is built using XHTML. Another question I have is how should I display data with rich snippets for the following: A link to a game that includes name, i ...

Adjusting footer position and spacing between header elements using CSS

Is there a way to ensure my footer always stays at the bottom, even when my content is limited? And how can I reduce the space between two heading tags? Check out the HTML and CSS code here: https://jsbin.com/guwugaloci/edit?html,css,output View t ...

What steps should be taken to validate an HTML5 form without actually submitting it?

I am working on a form that includes various HTML attributes such as: <form> <label>Full Name</label> <input type="text" name="firstname" class="span3" required="required"> <label>Email Address</label&g ...

How to Create a Compact JavaFX ComboBox

I'm attempting to create a more compact version of the ComboBox, but no matter what I try, the space between the text and arrow button remains consistent. When using the following CSS: .combo-box-base > *.arrow-button { -fx-padding: 0 0 0 0; ...

The issue with Open Sans and sans-serif fonts not rendering properly in all web browsers

I am having trouble with websites that use the Open Sans font appearing with a strange handwriting style. I'm not sure where this issue is originating from. Here are some things I have tried: Using In-Private browsing Disabling all extensions Testin ...

Is there a way to prevent the window.status from appearing?

I currently have the following code snippet: <a class="button accessLink" id="loginLink" href="#" data-action="Login" data-dialog="access" data-disabled="false" data-entity="n/a" ...