Responsive Semantic UI React Grid, Columns, Rows(响应式语义 UI React 网格、列、行)
问题描述
我无法让 Semantic UI React 网格完全响应,至少以我想要的方式响应桌面、平板电脑和移动设备.
I'm having trouble making Semantic UI React grid fully responsive, at least respond the way I want for Desktop, Tablet and Mobile.
我在网格列中呈现以下三个组件.
I have following three components which I am rendering in Grid Columns.
import React,{ Component } from 'react';
import { connect } from 'react-redux';
import { Grid, Header } from 'semantic-ui-react'
import GetJobs from '../../components/Home/GetJobs';
import PostForm from '../../components/Home/PostForm';
import Feed from '../../components/Home/Feed';
import Articles from '../../components/Home/Articles';
import './home.css'
class Home extends Component {
render() {
return(
<Grid id="home" stackable columns={3}>
<Grid.Row>
<Grid.Column>
<Header>Articles</Header>
<Articles/>
</Grid.Column>
<Grid.Column>
<Feed/>
</Grid.Column>
<Grid.Column>
<Header>Jobs</Header>
<GetJobs/>
</Grid.Column>
</Grid.Row>
</Grid>
)
}
}
export default Home;
从桌面设备转移到移动设备时,列可以正确堆叠.它从 3 列变为 1 列.但是,对于平板电脑大小,3 列只是更紧密地安装,而不是在屏幕上有 2 列,1 列堆叠在下方.
The columns stack properly when going from desktop to mobile. It goes from 3 to 1 column. However, at tablet size, the 3 columns are just fitted more tightly instead of having 2 columns on the screen, and 1 being stacked below.
查看组件组件的平板视图
理想情况下,我希望在从台式机切换到平板电脑大小以及从平板电脑切换到移动设备时,Feed 和 Jobs 留在屏幕上,Feed 位于顶部,Jobs 位于下方,Articles 位于底部.
Ideally, I'd like Feed and Jobs to stay on the the screen when going from Desktop to Tablet size, and when going from Tablet to Mobile, have Feed on top, Jobs below, and Articles at the bottom.
对于如何让这个网格做出这样的响应,我们不胜感激.
Any help is appreciated on how to get this grid to respond like this.
推荐答案
stackable
prop 仅在移动设备上折叠列,为了精确控制不同设备上的宽度,您应该使用 响应 道具.您也可以尝试使用 only 和 反向.我做了一个例子来说明如何做到这一点.
stackable
prop collapses columns only on mobile device, for precise control of widths on diffent devices you should use responsive props. You can also try to play with only and reversed. I made an example that shows how to do this.
<Grid>
<Grid.Column only='computer' computer={5}>
<Header>Articles</Header>
</Grid.Column>
<Grid.Column mobile={16} tablet={8} computer={5}>
<Feed/>
</Grid.Column>
<Grid.Column mobile={16} tablet={8} computer={5}>
<GetJobs/>
</Grid.Column>
<Grid.Column only='mobile tablet' mobile={16} tablet={16}>
<Header>Articles</Header>
</Grid.Column>
</Grid>
这篇关于响应式语义 UI React 网格、列、行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:响应式语义 UI React 网格、列、行


基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01