【问题标题】:Responsive Segment Layout with React Semantic UI带有 React 语义 UI 的响应式段布局
【发布时间】:2021-09-30 05:37:07
【问题描述】:

我在将 CSS gutters 添加到 Semantic-UI 网格时遇到了挑战。我有一个 Grid 列,其中一个段被重复呈现。

这是我的代码:

import React from 'react';
import ReactDOM from 'react-dom';
import { Segment, Grid, Image as ImageComponent, Item, Button } from 'semantic-ui-react'

export default class TeachersListSegment extends React.Component {
  render() {
    return (
        <div>
          <Grid.Column mobile={16} tablet={8} computer={8} largeScreen={8} widescreen={8}>
            <Segment stacked padded color='blue'>
              <Grid>
                <Grid.Row>
                  <Grid.Column width={11}>
                    <Item.Group link>
                      <Item>
                        <Item.Image size='tiny' src='https://semantic-ui.com/images/avatar/large/steve.jpg' />

                          <Item.Content>
                            <Item.Header><a>{this.props.header}</a></Item.Header>
                              <Item.Description>{this.props.description}</Item.Description>
                                 <Item.Description>Another Description</Item.Description>
                                  </Item.Content>
                                </Item>
                              </Item.Group>
                      </Grid.Column>
                      <Grid.Column width={5}>
                        <Button positive className="mb-3 teachers-list-button">Book Lesson</Button>
                        <Button basic color="green" className="teachers-list-button">Send Message</Button> 
                      </Grid.Column>
                    </Grid.Row>
                </Grid>
            </Segment>
            </Grid.Column>
        </div>
    );
  }
}

这是呈现片段的代码

<div className="page-content">
   <Grid stackable centered columns={2}>
      <Grid.Row>
         <TeachersListSegment header="Stevie Feliciano" description="Some Description" />
         <TeachersListSegment header="Stevie Feliciano" description="Some Description" />
         <TeachersListSegment header="Stevie Feliciano" description="Some Description" />
         <TeachersListSegment header="Stevie Feliciano" description="Some Description" />
         <TeachersListSegment header="Stevie Feliciano" description="Some Description" />
    </Grid.Row>
  </Grid>
</div>

目前的显示是这样的。向显示器添加列间距和行间距的有效方法是什么?我在上面的链接中应用了装订线样式,但没有用。 This question 还帮助我应用了正确的代码以使其具有移动响应能力。

对应用列和行间隙的解决方案有何建议?

【问题讨论】:

    标签: responsive-design semantic-ui grid-layout semantic-ui-react


    【解决方案1】:

    您可以将column 类添加到所有&lt;TeachersListSegment&gt; 中,并将其全部包装在&lt;div class="ui two column stackable grid"&gt; &lt;/div&gt; 中。

    【讨论】:

      猜你喜欢
      • 2018-07-28
      • 2017-12-17
      • 2018-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-11
      • 2017-07-09
      • 2017-07-28
      相关资源
      最近更新 更多