简体   繁体   English

CSS 文本缩进相当于适用于 Android 浏览器

[英]CSS Text-Indent equivalent to apply to Android Browsers

I have tabular data in a Telerik RadGrid where I'm converting the table cells <TD> 's to display: inline-block so they will "stack" vertically for mobile devices.我在 Telerik RadGrid 中有表格数据,我在其中将表格单元格<TD>转换为display: inline-block以便它们将为移动设备垂直“堆叠”。 Works great... except for when one of the items text is longer and is forced to wrap, where the 2nd line is not left-aligned with the first line.效果很好......除了当其中一个项目文本较长并被迫换行时,第二行未与第一行左对齐。 I was able to implement text-indent: hanging 45% , but it only resolves the issue for ios devices.我能够实施text-indent: hanging 45% ,但它只能解决 ios 设备的问题。 Apparently text-indent isn't supported in Android. Android 显然不支持text-indent

I"m using the:before psuedo element to apply content: attr(data-label) representing the column heading. An important note is that the "document name" is a link to download the document. An example is attached.我正在使用:before psuedo 元素来应用content: attr(data-label)表示列标题。重要的一点是“文档名称”是下载文档的链接。附上示例。

在此处输入图像描述

Is there an equivalent technique to mimic this behavior for non-ios mobile devices?是否有等效的技术来模拟非 ios 移动设备的这种行为?

I can see 4 options, similar look but with differences from the oldest method to the newest.我可以看到 4 个选项,外观相似,但从最旧的方法到最新的方法有所不同。 (excluding float and position) It also doesnt look alike anything you linked about telerik? (不包括浮动和位置)它看起来也不像你链接的关于 telerik 的任何东西?

They should all be working, android is not a browser tho:)他们应该都在工作,android 不是浏览器:)

options to test:测试选项:

 div { width: 300px; margin: 1em; border: solid; background: wheat; vertical-align: top; } div:before { content: attr(data-label); width: 120px; background: yellow } div[data-label="inline-table:"] { display: inline-table; } div[data-label="inline-table:"]:before { display: table-cell; } div[data-label="Column CSS:"] { display: inline-block; column-count: 2; } div[data-label="Column CSS:"]::before { display: block; min-height: 2.2em; } div[data-label="inline-flex:"] { display: inline-flex; } div[data-label="inline-flex:"]:before { display: table-cell; } div[data-label="inline-grid:"] { display: inline-grid; grid-template-columns: 1fr 1fr } div[data-label="inline-grid:"]:before {}
 <div data-label="inline-table:">This is the name of the document</div> <div data-label="Column CSS:">This is the name of the document</div> <div data-label="inline-flex:">This is the name of the document</div> <div data-label="inline-grid:">This is the name of the document</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM