网站建设资讯

NEWS

网站建设资讯

html5富文本,HTML富文本

学习前端html与html5有什么区别?

html通常指的是用来写网页的超文本代码,比如

成都创新互联公司专业为企业提供大厂网站建设、大厂做网站、大厂网站设计、大厂网站制作等企业网站建设、网页设计与制作、大厂企业网站模板建站服务,十多年大厂做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

div

img src="ttt.jpg" //div

html从最初仅用来表示文本转变到后来的富文本,甚至多媒体。上面的代码就在页面插入了一张图片。至此,html仅用来表示内容,有时也表示显示样式(现在已用css来描述内容了),还有简单的交互(现在用javascript)。

但是,到这个时候,很多功能在互联网上都要借助插件实现,比如播放多媒体,利用长连接进行通信,RPC等。于是,html5出来了,你可以认为他是html4后面的一个版本,但他不仅仅是html,还包含很多新加入的API,如文件API,websockt等。所以,通常被认为html5是web app开发所用到的html,javascript,css3等的总和

富文本设置文字颜色和字体

在iOS开发中,常常会有一段文字显示不同的颜色和字体,或者给某几个文字加删除线或下划线的需求。之前在网上找了一些资料,有的是重绘UILabel的textLayer,有的是用html5实现的,都比较麻烦,而且很多UILabel的属性也不起作用了,效果都不理想。后来了解到NSMuttableAttstring(带属性的字符串),上面的一些需求都可以很简便的实现。

-(id)initWithString:(NSString *)str attributes:(NSDictionary *)attrs;

字典中存放一些属性名和属性值,如:

NSDictionary *attributeDict = [NSDictionarydictionaryWithObjectsAndKeys:

[UIFontsystemFontOfSize:15.0],NSFontAttributeName,

[UIColorredColor],NSForegroundColorAttributeName,

NSUnderlineStyleAttributeName,NSUnderlineStyleSingle,nil];

NSMutableAttributedString *AttributedStr = [[NSMutableAttributedStringalloc]initWithString:@"今天天气不错呀" attributes:attributeDict];

-(id)initWithAttributedString:(NSAttributedString *)attester;

使用NSAttributedString初始化,跟NSMutableString,NSString类似

使用方法:

为某一范围内文字设置多个属性

-(void)setAttributes:(NSDictionary *)attrs range:(NSRange)range;

为某一范围内文字添加某个属性

-(void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range;

为某一范围内文字添加多个属性

-(void)addAttributes:(NSDictionary *)attrs range:(NSRange)range;

移除某范围内的某个属性

-(void)removeAttribute:(NSString *)name range:(NSRange)range;

运行效果:

另外,其他可以设置text 的控件(如UIButton,UITextField)也都有该属性,该文章不够详细,只是简单介绍,其他效果的实现参考API中更多的属性及使用方法。

html5 在线富文本编辑器怎么用

方法/步骤

1

!DOCTYPE html

html

head

titleImages upload/title

meta charset="utf-8"

meta name="viewport" content="width=device-width"

link rel="stylesheet" type="text/css" href="../css/style.css" /

script type="text/javascript" src="../lib/jquery-1.7.min.js"/script

link rel="stylesheet" href="../redactor/css/redactor.css" /

script src="../redactor/redactor.js"/script

script type="text/javascript"

$(document).ready(

function()

{

$('#redactor_content').redactor({ imageUpload: '../demo/scripts/image_upload.php' });

}

);

/script

/head

body

div id="page"

textarea id="redactor_content" name="content" style="height: 460px;"

h2Hello and Welcome/h2

pI never did quite grasp him, though he endeavored to explain it to me upon numerous occasions. I suggested telepathy, but he said no, that it was not telepathy since they could only communicate when in each others' presence, nor could they talk with the Sagoths or the other inhabitants of Pellucidar by the same method they used to converse with one another./p

p"What they do," said Perry, "is to project their thoughts into the fourth dimension, when they become appreciable to the sixth sense of their listener. Do I make myself quite clear?"/p

p"You do not, Perry," I replied. He shook his head in despair, and returned to his work. They had set us to carrying a great accumulation of Maharan literature from one apartment to another, and there arranging it upon shelves. I suggested to Perry that we were in the public library of Phutra, but later, as he commenced to discover the key to their written language, he assured me that we were handling the ancient archives of the race./p

pDuring this period my thoughts were continually upon Dian the Beautiful. I was, of course, glad that she had escaped the Mahars, and the fate that had been suggested by the Sagoth who had threatened to purchase her upon our arrival at Phutra. I often wondered if the little party of fugitives had been overtaken by the guards who had returned to search for them. Sometimes I was not so sure but that I should have been more contented to know that Dian was here in Phutra, than to think of her at the mercy of Hooja the Sly One. Ghak, Perry, and I often talked together of possible escape, but the Sarian was so steeped in his lifelong belief that no one could escape from the Mahars except by a miracle, that he was not much aid to us—his attitude was of one who waits for the miracle to come to him./p

/textarea

/div

/body

/html


文章名称:html5富文本,HTML富文本
网站链接:http://njwzjz.com/article/hocsjj.html