我正在使用由此命令安装的材料ui版本1.:
npm install -S material-ui@next
Run Code Online (Sandbox Code Playgroud)
每次我想使用时,页面中都会出现不需要的水平滚动.例如,这是一个简单的代码:
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles, createStyleSheet } from 'material-ui/styles';
import Paper from 'material-ui/Paper';
import Grid from 'material-ui/Grid';
/* project imports */
import NavMenu from './Page-Parts/NavMenu';
import LoginPanel from './Login-Parts/LoginPanel';
const styleSheet = createStyleSheet('FullWidthGrid', theme => ({
root: {
flexGrow: 1,
marginTop: 0,
},
paper: {
padding: 16,
textAlign: 'center',
color: theme.palette.text.secondary,
marginTop: "3rem"
},
}));
function Login(props){
const classes = props.classes;
return (
<div className={classes.root}>
<Grid container gutter={24} …Run Code Online (Sandbox Code Playgroud) 我创建了一个简单的表单.我在右下方添加了一个PushButton,然后是一个TabWidget.我突出显示了主窗口,并选择了网格布局.PushButton被拉伸了,所以我在它的左边增加了一个垫片.
现在,我的Tab Widget只占据最左边的列.我希望它也能跨越Column1.我查看了每个选项并尝试在任何地方右键单击,无法让设计人员创建跨度.
为了确保我没有遗漏任何东西,我直接修改了.ui文件,将tabspan ="2"添加到Tab Widget的标签,重新加载设计器,它显示完美.但是,我想尽可能地使用设计师.
任何想法如何让这跨越?
我想使与图像布局肖像图像内的div与固定纵横比3:2.图像的大小是327x491px.
主要问题是图像之间不需要的空间.如何仅使用HTML/CSS 将图像对齐为马赛克?
HTML:
<div id="pictures1" class="_pictures1 grid">
<div class="_pictures1-01"><div style="width:125px;height: 188px; background: red;"><img src="" width="125" height="188" alt="" /></div></div>
<div class="_pictures1-02"><div style="width:192px;height: 288px;background: green;"><img src="" width="192" height="288" alt="" /></div></div>
... SO ON ...
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
._pictures1 {
width: 935px; height: 490px;
margin: -26px 0 0 59px;
float: left;
top: 20%; left: 20%;
position: absolute;
border: 1px gray solid;
}
._pictures1 div {position: absolute;}
._pictures1-01 {top: 0px; left: 35px;}
._pictures1-02 {top: …Run Code Online (Sandbox Code Playgroud) 我创建了一个带有#containerdiv 的简单站点,它是两个div的父级:#left并且#right,通过使用Grid Layout:
有没有办法让左栏固定?我希望左侧文本保持其位置,并且正确的文本可以像现在一样滚动.添加position: fixed以#left打破布局.
我知道这个问题已经解决了,但我很欣赏一种方法,使它适用于网格布局.
谢谢.
body {
margin: 0 0 0 0;
}
#container {
display: grid;
grid-template-columns: 50% 50%;
}
.section {
padding: 5% 5% 5% 5%;
}
#left {
background-color: aquamarine;
}
#right {
background-color: beige;
}Run Code Online (Sandbox Code Playgroud)
<div id="container">
<div id="left" class="section">
<p>This should not scroll</p>
</div>
<div id="right" class="section">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla aliquet consectetur purus nec …Run Code Online (Sandbox Code Playgroud)我们如何在GridLayout中显示网格线?在Java?
JPanel panel = new JPanel(new GridLayout(10,10));
panel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
for (int i =0; i<(10*10); i++){
panel.add(new JLabel("Label"));
}
Run Code Online (Sandbox Code Playgroud) 有没有办法在两个display: grid/-ms-grid样式表中使用这两个样式表,或者我是否必须使用HTML hack或JavaScript来查询使用网格布局查看页面的浏览器类型?
例:
以下样式似乎不起作用
.container {
display: grid -ms-grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(150px, 50px);
grid-gap: 1vw;
-ms-grid-columns: repeat(4, 1fr);
-ms-grid-rows: repeat(150px, 50px);
-ms-grid-gap: 1vw;
}
Run Code Online (Sandbox Code Playgroud) 我正在研究一个java教程,看到在GridLayout中找到JButton的x/y索引的方法是遍历与布局关联的按钮b的二维数组,并检查是否
b[i][j] == buttonReference.
@Override
public void actionPerformed(ActionEvent ae) {
JButton bx = (JButton) ae.getSource();
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
if (b[i][j] == bx)
{
bx.setBackground(Color.RED);
}
}
Run Code Online (Sandbox Code Playgroud)
是否有更简单的方法来获取按钮的X/Y索引?
就像是:
JButton button = (JButton) ev.getSource();
int x = this.getContentPane().getComponentXIndex(button);
int y = this.getContentPane().getComponentYIndex(button);
Run Code Online (Sandbox Code Playgroud)
this是一个GameWindow实例,ev当用户按下按钮时触发ActionEvent.

在这种情况下,它应该得到:x == 2,y == 1
@ GameWindow.java:
package javaswingapplication;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
public class …Run Code Online (Sandbox Code Playgroud) 我想为我当前的Web项目使用易于使用的网格框架.以下是我将欣赏的功能:
我找到了许多网格,但将其缩小到以下三个有希望的框架,这些框架可能非常适合我的要求:
以下是其他所有内容:
通常情况下,我会在问这里之前自己测试一下,以便我可以制定更具体的问题.但由于有大量的框架,我想听听一些指示从哪里开始.
我结束了使用Foundation,这显然是这场比赛的胜利者 - 以我的拙见.
Bootstrap 3现在是一个真正的竞争对手,因为它也支持语义网格类.它支持SASS和LESS.
根据Foundation关于网格组件的文档,我基本上可以使用它们的偏移类将一个或多个网格列作为空格:
<div class="row">
<div class="large-1 columns">1st column</div>
<div class="large-9 large-offset-2 columns">2 spaces to the left of this column</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这将产生1列,然后是2列普通空间和9列.是否可以将这些偏移量放在元素的右边而不是左边?例如,这样的事情?
<div class="row">
<div class="large-1 columns">1st column</div>
<div class="large-9 large-offset-right-2 columns">2 spaces to the right</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在开发一个"匹配以下"的应用程序.用于该应用程序的xml如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lytLinear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="30dp"
android:text="Match the following questions with their answers." />
<GridLayout
android:id="@+id/lytGrid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="3"
android:columnWidth="300dp"
android:orientation="vertical"
android:rowCount="5"
android:stretchMode="columnWidth" >
<LinearLayout
android:id="@+id/Q1Lyt"
android:layout_width="160dp"
android:layout_height="50dp"
android:layout_column="0"
android:layout_row="0"
android:background="@drawable/shape_qn"
android:gravity="center" >
<TextView
android:id="@+id/Q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
android:text="Question1" />
</LinearLayout>
<LinearLayout
android:id="@+id/A1Lyt"
android:layout_width="160dp"
android:layout_height="50dp"
android:layout_column="1"
android:layout_row="0"
android:background="@drawable/shape"
android:gravity="center"
android:text="Answer1" >
<TextView
android:id="@+id/A1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
android:text="Answer1" />
</LinearLayout>
<LinearLayout
android:id="@+id/Q2Lyt"
android:layout_width="160dp"
android:layout_height="50dp"
android:layout_column="0"
android:layout_row="1"
android:background="@drawable/shape_qn"
android:gravity="center" >
<TextView
android:id="@+id/Q2"
android:layout_width="wrap_content" …Run Code Online (Sandbox Code Playgroud) grid-layout ×10
css ×3
css3 ×3
css-grid ×2
html ×2
java ×2
swing ×2
android ×1
aspect-ratio ×1
awt ×1
javascript ×1
material-ui ×1
offset ×1
qt-creator ×1
qt4 ×1
reactjs ×1