When using Flexbox for typesetting, you sometimes encounter a similar problem. The content cannot be stretched when it overflows, causing the background to be unable to display the entire block.
You can find the overwriting done in Modal in order to change the gutter's spacing setting.
But because the v5 version changed to use createGlobalStyle of styled-component to set the :root CSS variable, when the light box is inserted into the Dom,
createGlobalStyle inserts new settings into the dom again, overwriting the original CSS settings, causing the version to run.
Warning
Please do not use GridThemeProvider again in the lower layer, causing secondary generation: the root parameter will overwrite the original parameter.
Overriding styles are used in v4.x version. For v5.x version, please make good use of utils className gx-? or CSS variable --bear-gutter-x
Front-end design and development, including design and development
Over-reliance on content, static hard-coded layout
Highly written to death
Padding
Because the design draft is dead, in the case of an unstandardized design draft, we should continue with the front-end specification, or the first version of the design specification.
You shouldn’t just follow it without specifications. “Responsive design” considers not just different displays in different sizes, but “adaptation to space.”
Regardless of whether designers today start from the perspective of graphic design, we should all think about "responsive design" as the starting point.
One of the biggest problems is "over-reliance on content"
Text modification, changes, and text lengths in different languages are calculated just right, with one height setting for each size (xs, sm, md, lg, xl, xxl)
Should high-height content be stretched or overflow characters?
Write down the width and height, each Padding, Margin according to the design draft, and set it carefully according to each size (xs, sm, md, lg, xl, xxl each setting)
The common settings are recognized, the design draft will not be moved, and the macro adjustment example should not become only xs -> md -> xxl
Regardless of the full page, the width should be expanded by the content, and the width should be written directly. According to the design draft, each size should be carefully set.
Identify whether it is full version or content expanded height + Padding
Project card list, if the project is added, calculate the number of pixels
100px cut into 4 equal parts should be 25%, not 25px
Uniformly use the margin-bottom principle to open the bottom and how much space should be separated
Tweens within the project, for Padding
Since we occasionally encounter padding in design, but specific elements are full, it is recommended to set padding between each block instead of setting padding for a large block, and this padding is a fixed CSS parameter. set up
If possible, it doesn’t matter if you have one more layer. Don’t just think about copying.
Sometimes cutting the front-end design into layout layer and style layer is of great help for subsequent maintenance, reading and adjustment.
Allows you to directly separate categories in your vision
There is no BEM naming problem when using Styled-component because it will do BEM for you.
This naming issue also involves clearly defining the dom structure,
Container is Container, Grid is Grid,
Component splitting makes it easier for us to name separate spaces.
For example:
Title and Desc are almost everywhere. If the namespace is not split, they will be ProductTitle and GoodsTitle.
No matter what, there must be a grid system and ZIndex principle
You need to have a system responsible for typesetting, whether it is a boostrap grid system or a tailwind grid system. As long as all customization is not blind, "I want it to be the same as the design draft"
Grid is a grid system that you can think of as a table. It has concepts similar to a table, such as merging cells, rows, and columns.
Compared to Flexbox, it transitions from a one-dimensional to a two-dimensional layout, with proportions often determined by external declarations in most cases.
In Grid, instead of using percentages for grid layout, you specify the actual number of grid tracks an item occupies (e.g., 5fr). This eliminates issues where the gap isn't calculated as a percentage (e.g., as in Flexbox). This aspect is a relative advantage of Grid because you don't need to use negative margins on rows to offset column padding.
Then we will notice that it doesn't have the same issues as Flexbox, with different main axes for columns and rows. We can simply treat it as if it's just a row. If you're not familiar with Flexbox, you might wonder why the layout is filling the space even when the width is set to auto?
Yes, this is the alignment feature of Flexbox and Grid. In Normal, the sub-items will fill up. If you don't want to fill them up, then you need to give it an alignment mode.
Then we will find that it is just like Flexbox. Although it still has Column and Row, it does not have the problem of different main axes and intersecting lines.
In addition, the definitions of items and content also need to be clearly clarified (ex: align-items, align-content)
items: Alignment of individual items
content: content alignment
place-content: set align-content and justify-content at the same time
place-items: set align-items and justify-items at the same time
This means grid-auto-columns: repeat(3, auto), and in CSS-in-JS, you can use children.count() for general layout purposes. The gap is set to 2px. However, if you are creating a product list today, you can specify proportions.
Arrange left to right or top to bottom? like flex-direction
The alignment demonstration of Flexbox column is in this way. I hope that it exceeds the line break from top to bottom, rather than from left to right and exceeds the line break. Sample
Flexbox can be used as Gap, directly speaking, it solves what Grid System wants to do, which is to use negative Margin in Row to offset the padding of Col at the beginning and end of a row.
Then... is there no problem?
I think if it was better, Bootstrap 5 would have changed it long ago
We can find that the length of the Gap will not be calculated and included in the flex item (25% * 4 if the ratio is used to allocate the space), that is, the Gap will be more than 100%, causing the version to run.
You can use an algorithm to use flex-basis: 0 0 ratio, but you can also use gap.
The above is used. Grid System, the following is using Flex + to calculate Gap. It seems to be aligned, but there seems to be no difference? Kind of like Gap for the sake of thinking Gap
One thing to note is that the design of Bootstrap 5 is to override --bs-gutter-x
The advantage of doing this is that we often introduce many different components so that they will not be affected
The next layer of nesting will not be affected. If you need the same thing below, you need to cover the lower layer again.
Or set it from the final configuration file, which means that gutters is actually needed.
Because we will need different gutter for grids in different sizes, and unify their gutter,
Then make different gutter according to some blocks
As a front-end engineer, I have never had a very systematic way to use Flexbox alignment. I often use align-item-center when I need to align to center, and if that doesn't work, I'll try justify-content-center. If that still doesn't work... well, it should be a parent container height problem.
It's time to come up with a way to remember it today.
So we only need to remember that if the current flex direction is flex-row, then to center vertically, we need to control the opposite of the main axis. The cross axis is controlled by align-item. Conversely, if the current flex direction is flex-column, then to center vertically, we need to control the main axis. The main axis is controlled by justify-content.