Home> php教程> php手册> body text

使用readonly属性让失效文字更易阅读

WBOY
Release: 2016-06-21 09:14:16
Original
1338 people have browsed it

ado

已经厌倦了眯着眼睛看灰色文字?Readonly可以为你提供一种更好的解决方案



现在我发现自己变老的确切信号不是周身不适,而是要理解Web页面中输入框或文本区域中失效文字(disabled text)所表达意思已经变得越来越困难。对于像我这样怀念古老的Windows 2000的老家伙来说,那些灰色的文字似乎已经有同背景融为一体的趋势。

幸好,还有比做眼部激光外科手术更为廉价的解决方案,即使用名为readonly的属性。该属性将按照同正常文本相同的对比度来显示失效文字,同时仍然保持文字“远观而不可亵玩焉”的失效特性。这成为了平衡二者的最佳方式。

列表A显示了如何使用这一属性的示例,列表B则显示了实际中的情况。总之,这绝对是比拜访眼科医生更为廉价的选择。

列表A:



br/>
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>





Read Only






cellpadding="0px">




align="left">Normal:


align="left">Disabled:

Read

Only:








id="txtNormal"

name="txtNormal" size="10"

value="xyzzy" />






id="txtDisabled" name="txtDisabled"

size="10" value="xyzzy"

disabled="disabled" />






id="txtReadOnly" name="txtReadOnly"

size="10" value="xyzzy"

readonly="readonly" />










rows="4" cols="30">Always

do right. This will gratify

some people and astonish the

rest. - Mark

Twain






rows="4" cols="30"

disabled="disabled"

readonly="readonly">Always do

right. This will gratify some

people and astonish the rest. -

Mark Twain






rows="4" cols="30"

readonly="readonly">Always do

right. This will gratify some

people and astonish the rest. -

Mark Twain















Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn