Tags down


How to adjust the width of react flexbox grid items to allow space between them?

By : nuke nukem
Date : October 18 2020, 06:10 AM
wish help you to fix your issue Do not use float together with flex. It's useless. Better yet, do not use float at all when it comes to layout.
You can use flex on the container together with justify-content: space-between.
code :
.wrapper {
  width: 100%;
  justify-content: space-between;

.item {
  background: red;
  width:calc(50% - 20px);
<div class="wrapper">
  <div class="a item">
  <div class="b item">

Share : facebook icon twitter icon

Using flexbox, vertically center items and respect top 150px space of flexbox container

By : Benjamin Vega
Date : March 29 2020, 07:55 AM
Hope this helps I am trying to craft a flexbox in CSS with the following characteristics: , This might work for you:
HTML (add two invisible flex items)
code :
<div class="parentFlexBox">
    <div class="itemA">A</div>
    <div class="itemB">B</div>
    <div class="itemC">C</div>
    <div class="itemD">D</div>
    <div class="itemE">E</div><!-- invisible spacer item with 150px height -->
    <div class="itemF">F</div><!-- invisible spacer item with 120px height -->
.parentFlexBox { justify-content: space-between; } /* changed from `center` */

.itemA { order: 1; } /* removed `margin-top: auto` */

.itemB { order: 2; } 

.itemC { order: 3; }

.itemD { order: 5; height: 30px; } /* added `height` for centering calculation;
                                      removed `margin-top:auto` */
.itemE { 
      order: -1;  
      flex: 0 0 150px; /* don't grow, don't shrink, remain at 150px height */
      visibility: hidden;
      margin-bottom: auto; /* stick to top of container */

.itemF {
      order: 4;
      flex: 0 1 120px; /* don't grow, shrink proportionally, start at 120px height */
      visibility: hidden;
      margin-top: auto; /* go south as much as possible (sticks to Item D) */

/* NOTE: Item D has height 30px. Item F has height 120px. Together they equal height of
   Item E. Equally balanced on both ends, Items A, B & C are centered in the container. */
.parentFlexBox::before {
  content: '';
  flex: 0 0 150px;
  visibility: hidden;
  margin-bottom: auto;

.parentFlexBox::after {
  content: '';
  flex: 0 1 100px;
  visibility: hidden;
  margin-top: auto;
  order: 4;

Programmatically change height/width of items in react-grid-layout

By : nhjunhujymmmm
Date : March 29 2020, 07:55 AM
this will help It turns out the trick is to not use the _grid and instead use the layout prop on the Grid component. Here is a working jsfiddle:
code :
const Grid = ReactGridLayout.WidthProvider(ReactGridLayout);

class Logo extends React.Component {
    constructor(props) {
        this.state = {
            layouts: [
                    i: '0',
                    x: 0,
                    y: 0,
                    w: 5,
                    h: 25,
                }, {
                    i: '1',
                    x: 5,
                    y: 0,
                    w: 7,
                    h: 30,
            collapsedWidgets: {},

    toggleWidget(id) {
        return () => {
            const newState = {...this.state.collapsedWidgets};
            const collapsed = typeof newState[id] === 'boolean' ? newState[id] : false;

            newState[id] = !collapsed;
                collapsedWidgets: newState,


    onResize(layouts) {

    getModifiedLayouts() {
        const { layouts, collapsedWidgets } = this.state;

        const newLayouts = layouts.map(layout => {
            const newLayout = { ...layout };
            if (collapsedWidgets[newLayout.i]) {
                newLayout.h = 5;
            return newLayout;

        return newLayouts;

    getWidgets() {
        const widgets = [{
            component: <div style={{ height: '250px', background: 'lightgray' }}>Content</div>,
            title: 'Item 1',
            id: '0',
        }, {
            component: <div style={{ height: '310px', background: 'lightgray' }}>Content 2</div>,
            title: 'Item 2',
            id: '1',
        return widgets;

    generateDOM() {
        const widgets = this.getWidgets();

        return widgets.map((widget, i) => {
            return (<div key={i} style={{ overflowY: 'auto' }}>
                <div style={{ background: 'gray' }} onClick={this.toggleWidget(widget.id).bind(this)}>

    render() {
        const widgets = this.generateDOM();

        const modifiedLayouts = this.getModifiedLayouts();

        return (<div style={{ marginTop: '15px' }}>
                {widgets ? <Grid className="layout"
                </Grid> : null}

Logo.defaultProps = {
        isDraggable: true,
        isResizable: true,
        rowHeight: 1,
        cols: 12,

React.render( <Logo /> , document.getElementById('container'));

Equal margin space for flex items that wrap in flexbox grid

By : Vagner Seibert
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I am trying to create a responsive grid with flexbox: , You can add a margin to the grid items...
code :
.gridColumn {
    margin: $margin;
.grid {
    margin: -$margin;

Fill remaining space in react-virtualized Grid if total columns width is less than Grid width

By : T. Doan
Date : March 29 2020, 07:55 AM
Any of those help Assuming you want to fill the remaining space with the alternating colors (not entirely clear from your question) then you have two options.
For both options, you will need to detect when the width of your visible columns is less than the width of the Grid. (You didn't share your source code so I'm not going to make suggestions about exactly how to do this. It should be simple enough though!)

Adjust DataGridView's columns to fill available space if the grid is smaller and use scroll in case the grid bigger than

By : barun kumar
Date : March 29 2020, 07:55 AM
hop of those help? Click over the DataGridView and select "Edit Columns...", then go to "Layout" and set "AutoSizeMode" to "Fill".
Hope this is what you're looking for.
Related Posts Related Posts :
  • HTML table with millions of cells ignores cell's fixed dimensions
  • Alternately coloring the virtual rows created by CSS flex
  • Checkbox change event receiving undefined value
  • Layout breaking when title of post breaks to next line or stacks
  • How to rotate an image in all the direction using css
  • Cannot open link in a new tab inside iframe
  • Hyperlinks do not work on left mouse click
  • Bootstrap - NavBar is not collapsing well first element
  • Which input type is this?
  • Steam a live Video using HTML
  • How to style the last Angular component on the page?
  • How to scale an image to its original size by CSS?
  • Can i write typescript with in <Script> tag?
  • Smalltalk Seaside - How do I change the size of a button?
  • Validation of input type number in Angular 6
  • How to prevent VS Code from breaking up long HTML lines into multiple lines?
  • How can I add 2 separate backgrounds in html?
  • WCAG 2.0 redundant links
  • determining width of container based on how many flex items
  • I want to put footer at the bottom of the page
  • Have footer be pushed to the bottom without hovering over info
  • Why does viewbox attribute affect the size of the SVG element?
  • Is there a way to implement proper links using `<a href="/">` with github pages?
  • Changing CSS with the checkbox check
  • Insert React variable as attribute in html tag
  • How to give opacity to parent div in such a way that it does not effect child div?
  • Making 2 lists Side-by-Side
  • Convert XML to HTML Table in XSLT
  • Why am I getting error in *ngIf of angular reactive form
  • How can I make my site open Instagram in-app?
  • How to select h4 heading
  • Aligning flex items vertically
  • How to create images with border radius?
  • html: max function in font-size doesn't work
  • How to make an element sticky?
  • Vertically align html-entity characters in monospace font?
  • Fitting a 'widescreen' image into a square div
  • How to create background with triangle shapes?
  • How can I spread out my flex items to more than the width of a container?
  • Unable to put anchor tag inside HTML code tag
  • Center fit images of any size to parent div
  • Why doesn't my CSS border appear on a span around a button?
  • How to implement light color change of a traffic light with pure css?
  • Make CSS max-width larger than parent
  • How to apply `display:none;` to everything except an `<td class="cc">text</td>`?
  • dateClick not emitted in fullcalendar angular
  • What is the difference between HTML and XHTML?
  • How can check if a button was clicked a second time?
  • Making a scrollable div that encompasses the entire height of the PDF
  • align-self: flex-end breaks on mobile zoom
  • HTML5 video stops when CSS animation plays
  • How to get the last 3 created objects from the database?
  • How can I add a border to an image that has padding?
  • Changing the direction of a Flexbox HTML CSS
  • Whats forcing the menu to go to the left?
  • How to exclude the hovered td from table's hover?
  • Errors in HTML - red ending paragraph tags
  • Controlling the width of content in a Flexbox HTML CSS
  • Align footer at the bottom of the content, push to right of the sidebar
  • How to render a static html page in ReactJS?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk