public void setColumnWidth(int columnIndex, int width)设置宽度(以字符宽度的 1/256 为单位)
哪个字符的宽度的 1/256 ?不同的字符有不同的宽度。我在这里缺少什么?
我是 CSS 新手,希望有人能帮助我解决这个问题。
我正在尝试将简单的自定义样式应用于文件上传按钮(作为HTML 表单的一部分),使其看起来与页面上的其他按钮相似,并在跨浏览器上获得相似的外观。
到目前为止,我已经按预期工作了以下内容。我现在唯一的问题是我希望按钮占据其父 div 的完整宽度(在我的例子中,这将跨越页面的 9/12('col-9'))。
我尝试添加width: 100%;到 CSS 但按钮不再起作用。
我的HTML:
<div class="col-3 frmCaption">Attachments:</div>
<div class="col-9">
<div class="customUpload btnUpload btnM">
<span>Upload files</span>
<input type="file" class="upload" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
.btnDefault, .btnUpload {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
color: #333333;
cursor: pointer;
font-weight: 400;
display: inline-block;
padding: 6px 12px;
text-align: center;
text-decoration: none;
vertical-align: middle;
}
.btnDefault:focus, .btnDefault:hover, .btnUpload:focus, .btnUpload:hover {
background-color: #E6E6E6;
}
.btnM {
border-radius: …Run Code Online (Sandbox Code Playgroud) 我有一个 div,我想在其中显示一个人的名字。
我只想在正常状态下显示该人的名字。当您将鼠标悬停时,姓氏应出现在名字的右侧,其宽度从 0 扩展到正常宽度。所有这些文本都右对齐。
如果我将过渡应用于姓氏范围,它甚至不会显示。
我还尝试了 max-width (就像一个人在这里所做的那样: http: //jsfiddle.net/qP5fW/87/),但它不起作用。所以我做了一个包装 div,使用 width 而不是 max-width,现在它可以工作了,只是它根本不显示过渡。
我怀疑问题出在“auto”属性上,但如果有人知道如何进行转换,我将非常感激。
这是我的小提琴: https: //jsfiddle.net/drywrsy6/
HTML:
<div class="name">
<span class="first">John</span>
<div class="last-wrapper">
<span class="last">Doe</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.name {
border: 1px solid lightgrey;
margin: 10px auto 0px auto;
padding: 5px;
width: 300px;
font-size: 2em;
text-align: right;
overflow: hidden;
white-space: nowrap;
}
.first {
font-style: italic;
}
.last-wrapper {
display: inline-block;
vertical-align: bottom;
overflow: hidden;
width: 0;
transition: all 1s;
}
.last {
color: red;
} …Run Code Online (Sandbox Code Playgroud) 我想用四个具有相同宽度和高度的按钮填充整个屏幕,所以我认为网格布局是一个好主意:
<GridLayout
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="2"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_columnWeight="1"
android:layout_rowWeight="0"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_columnWeight="1"
android:layout_rowWeight="0"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
/>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
不幸的是我的结果看起来像这样:
我不明白为什么第二排的高度这么大?
我认为网格布局中的每个单元格都有相同的宽度和高度!
我试图将元素的高度设置为其宽度。它应该根据网络浏览器分辨率的变化自动缩放/保持大小比例。有没有办法只用 html 模板来做到这一点?就像是:
<div class="tile" #square [ngStyle]="{'height.px': square.width}">
Run Code Online (Sandbox Code Playgroud) 我的页面结构如下图所示。单击元素中的任意位置时,#progress我想计算单击的全宽度的百分比。
如何才能做到这一点?
< div id="progress" onMouseUp={ e => this._seekTo(e) }></div>
Run Code Online (Sandbox Code Playgroud)
...
_seekTo(event) {
var progress = document.getElementById('progress');
console.log((event.clientX - progress.offsetLeft) / progress.offsetWidth * 100)
}
Run Code Online (Sandbox Code Playgroud)

我需要根据其标签文本更改 CollectionView 单元格宽度,如下所示
为此,我给出了 CollectionView 约束
top, leading, trailing, = 10 height = 80
Run Code Online (Sandbox Code Playgroud)
在单元格中,我在 uiview 中放置了标签,我放置了 uiview 因为我需要给角半径
和代码
class SearchFilterVC: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
var textArray = ["hbdhwebhj", "behgwfhjewgbkfjbe", "hbhjs", "bdhsbfhegu", "gwdgyqwuguq"]
@IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 5
self.collectionView.collectionViewLayout = layout
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return textArray.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: …Run Code Online (Sandbox Code Playgroud) 我的 Chakra UI 框或弹性项目有问题(不确定是哪一个导致问题)。我无法让它们在平板电脑和手机上采用 100% 宽度。我设法使其工作的唯一方法是定义 VW 宽度,但这并不是在所有设备上都有响应。
它应该是什么样子:
代码(不起作用的代码部分是第一个三元选项):
enter code here
Run Code Online (Sandbox Code Playgroud)
enter code here
Run Code Online (Sandbox Code Playgroud)
import React from 'react'
import { Box, Flex, useMediaQuery } from '@chakra-ui/react'
import Section from 'components/section/Section'
import HoursCellList from 'components/schedule/hours/HoursCellList'
import DaysCellList from './days/DaysCellList'
import EventsComponent from 'components/schedule/events/EventsComponent'
import MobileDaysCellList from './days/MobileDaysCellList'
import MobileEventsFlex from 'components/schedule/events/MobileEventFlex'
interface Props {}
const ScheduleComponent = (props: Props) => {
const [isSmallScreen] = useMediaQuery('(max-width: 1350px)')
const [mobileClickedDay, setMobileClickedDay] = useState<number>(0)
return (
<Section isGray heading="Schedule" id="schedule">
<Box …Run Code Online (Sandbox Code Playgroud)有人有任何问题吗?px和em工作正常,%什么都不做.我只想在IE8中扩展这个div的屏幕长度.请微软.一直在寻找一段时间来利用.
CSS
#topPane {width:100%;
height:100px;
background-color:#0C9;}
Run Code Online (Sandbox Code Playgroud)
HTML
<div id="topPane">a</div>
Run Code Online (Sandbox Code Playgroud) 大家好我是法国人因为我的英语而烦恼我这里是我的问题:我们如何定义视图的高度和宽度.这里它的名字是flakeView.这是代码:
UIImageView* flakeView = [[[UIImageView alloc] initWithImage:flakeImage] autorelease];
// use the random() function to randomize up our flake attributes
int startY = round(random() % 320);
// set the flake start position
flakeView.center = CGPointMake(490, startY);
flakeView.alpha = 1;
// put the flake in our main view
[self.view addSubview:flakeView];
[UIView animateWithDuration:7
animations:^{
// set the postion where flake will move to
flakeView.center = viewToRotate.center;
}];
Run Code Online (Sandbox Code Playgroud) width ×10
css ×4
html ×4
height ×3
javascript ×2
android ×1
angular ×1
apache-poi ×1
block ×1
chakra-ui ×1
excel ×1
fixed-width ×1
flexbox ×1
hover ×1
iphone ×1
java ×1
label ×1
mouseevent ×1
percentage ×1
reactjs ×1
swift ×1
uiimageview ×1