在Aptana Studio中,如何更改我的代码以避免警告“应该删除空白”?[英]How do I change my code to avoid warning “should trim empty ” in Aptana Studio? 本文翻译自  Joanne Gil  查看原文  2011-11-12  14934    css/

时间:2022-04-22 15:43:38

I use 'class' when I need CSS function. For example, when I want to use clear: left; I make a class .clear {clear: left;} and use it in HTML file.

当我需要CSS函数时,我使用class。例如,当我想用clear: left;我创建一个类。clear {clear: left;}并在HTML文件中使用它。

But there is always the warning

但警告总是存在的

should trim empty

应该削减空

Luckily, it's not error so I don't care greatly. But it bother me sometimes.

幸运的是,这不是错误,所以我不太在意。但它有时也困扰着我。

Is there any solution sticking my habit?

有什么办法可以坚持我的习惯吗?

6 个解决方案

#1


35  

For Aptana Studio users:

Aptana Studio用户:

Windows: go to Window > Preferences > Aptana Studio > Validation

窗口:转到窗口>首选项> Aptana Studio >验证

(Mac: go to Aptana Studio > Preferences > Aptana Studio > Validation)

(Mac:进入Aptana Studio > Preferences > Aptana Studio > Validation)

Select HTML Tidy Validator then some collapse-able options will appear. Select Elements, it will show a list of options. Now go to the bottom of the list and you'll see "Trim Empty Elements": change it from warning to ignore.

选择HTML Tidy Validator,会出现一些可折叠的选项。选择元素,它将显示选项列表。现在转到列表的底部,您将看到“修饰空元素”:将它从警告更改为忽略。

#2


15  

I'm assuming your talking about Aptana Studio maybe some other IDE's do the same thing, I dont know? Any how you can simply add a space between the div tags like so:

我猜你说的是Aptana Studio也许其他IDE也会这么做,我不知道?如何在div标签之间添加空格,比如:

<div id="someDiv" class="clearLeft"> </div>

or add a comment between the tags like this:

或者在标签之间添加这样的注释:

<div id="someDiv" class="clearLeft"><!----></div>

This should remove the warning message and wont cause any issue with your html.

这将删除警告消息,不会对html造成任何问题。

在Aptana Studio中,如何更改我的代码以避免警告“应该删除空白”?[英]How do I change my code to avoid warning “should trim empty ” in Aptana Studio?
			      
			      
			      
			      
			      
			      
			         本文翻译自
			      
			      
			       Joanne Gil
			       查看原文
			      
			       2011-11-12
			       14934 
                  
                      
                     
                     
                     
                     css/
                                          
                     
                     trim/
                                          
                     
                     aptana/
                                          
                     
                     
                     html                     
                     
                  
			        
			          
				        
				      
			      
			      
			          
						
						     (adsbygoogle = window.adsbygoogle || []).push({});
 						
                 
                        
                        
                            I use 'class' when I need CSS function. For example, when I want to use clear: left; I make a class .clear {clear: left;} and use it in HTML file. 
当我需要CSS函数时,我使用class。例如,当我想用clear: left;我创建一个类。clear {clear: left;}并在HTML文件中使用它。 
But there is always the warning 
但警告总是存在的 
 
 should trim empty  
 应该削减空 
 
Luckily, it's not error so I don't care greatly. But it bother me sometimes. 
幸运的是,这不是错误,所以我不太在意。但它有时也困扰着我。 
Is there any solution sticking my habit? 
有什么办法可以坚持我的习惯吗?

     (adsbygoogle = window.adsbygoogle || []).push({});6 个解决方案
                           
                           
							  
							    #1
							    
							      35  
For Aptana Studio users: 
Aptana Studio用户: 
Windows: go to Window > Preferences > Aptana Studio > Validation 
窗口:转到窗口>首选项> Aptana Studio >验证 
(Mac: go to Aptana Studio > Preferences > Aptana Studio > Validation) 
(Mac:进入Aptana Studio > Preferences > Aptana Studio > Validation) 
Select HTML Tidy Validator then some collapse-able options will appear. Select Elements, it will show a list of options. Now go to the bottom of the list and you'll see "Trim Empty Elements": change it from warning to ignore. 
选择HTML Tidy Validator,会出现一些可折叠的选项。选择元素,它将显示选项列表。现在转到列表的底部,您将看到“修饰空元素”:将它从警告更改为忽略。
							     
							                          
                           
							  
							    #2
							    
							      
15  
I'm assuming your talking about Aptana Studio maybe some other IDE's do the same thing, I dont know? Any how you can simply add a space between the div tags like so:  
我猜你说的是Aptana Studio也许其他IDE也会这么做,我不知道?如何在div标签之间添加空格,比如: 
<div id="someDiv" class="clearLeft"> </div>
 
or add a comment between the tags like this: 
或者在标签之间添加这样的注释: 
<div id="someDiv" class="clearLeft"></div>
 
This should remove the warning message and wont cause any issue with your html. 
这将删除警告消息,不会对html造成任何问题。 

							     
							                          
                           
							  
							    #3
							    
							      
2  
If you are using Aptana Studio : 
如果你正在使用Aptana工作室: 
Go to Window > Preferences > Aptana Studio > Validation > HTML. 
到窗口>偏好> Aptana Studio >验证> HTML。 
Change the two checks by "HTML Tidy Validator" into "X". Alternatively, you could click "+" to add a regular expression to filter out the error. 
通过“HTML Tidy Validator”将这两个检查更改为“X”。或者,您可以单击“+”添加正则表达式以过滤掉错误。
							     
							                          
                           
							  
							    #4
							    
							      
0  
This is a fairly old question, but I feel obliged to point a few things out: 
这是一个相当古老的问题,但我觉得有必要指出以下几点: 
Empty elements are acceptable if used correctly. E.g. the javascript templating engine pure.js relies completely on them. 
 如果使用正确,可以接受空元素。例如,纯javascript模板引擎。js完全依赖它们。 
 In your case ideally you should add the clear:left to element after the floated element, rather than using utility elements. DOM classes should have nothing to do with the css itself (e.g. clear), but rather should describe the document structure (which in turn allows you to clear the logical elements). Either way, that's the ideal world and it's fairly common to use css the way you are using it and there isn't too much wrong with it (the only disadvantage being that you need to change the DOM if you want to change the look of your site). 
 在理想情况下,应该在浮动元素之后添加clear:left to元素,而不是使用实用程序元素。DOM类应该与css本身无关(例如,clear),而应该描述文档结构(从而允许您清除逻辑元素)。不管怎样,这是理想的世界,使用css的方式是非常常见的,并且没有太多的错误(唯一的缺点是,如果想更改站点的外观,就需要更改DOM)。 
 The worst thing to do is adding &nbsp; as that ignores the reason behind the warning entirely and just 'bypasses' it. 
 最糟糕的事情莫过于添加因为这完全忽略了警告背后的原因,而只是“绕过”它。 

							                          
                           
							  
							    #5
							    
							      
-1  
Try doing this: 
试着这样做: 
    .clear {
        clear: left;
    }
 
Happend to me with empty divs written in the same line. 
用同样的诗句写着空洞的歌谣。
							     
							                          
                           
							  
							    #6
							    
							      
-2  
Another solution is giving your empty div an id  
另一个解决方案是给空div一个id 
<div id="myEmptyDiv"></div>

							     
							                          
                           
                        
                 
               
				
				     (adsbygoogle = window.adsbygoogle || []).push({});
				
			     
			     		     
			     
			         
		              ×
		              注意!
		              
		              本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/11/12/3d1f658eb02630c4f362408b49a7e024.html。
		              
		              
		            	
		            
			
		    
		          
		          
			          
				          
					      timeout_show();
					      			
			
			
			  
			   
			   
			   
			       
			           How do I avoid rebuilding my database everytime I make a change to my Windows Workflow
			       
			       			       
			   
			       
			           How do I turn off automatic updates in Aptana Studio for Eclipse?
			       
			       			       
			   
			       
			           Recompile my code with -Xlint:unchecked.After recompiling with -Xlint , unchecked call warning appears . how do i run my program now? 
			       
			       			       
			   
			       
			           How do I change my password in Linux? 
			       
			       			       
			   
			       
			           how do I avoid my placeholder to be in uppercase in Internet Explorer 9
			       
			       			       
			   
			       
			           How do I avoid a race condition in my Rails app?
			       
			       			       
			   
			       
			           How do I avoid that my App enters optimization on Samsung devices
			       
			       			       
			   
			       
			           How do I trim a hash?
			       
			       			       
			   
			       
			           How Do I Arrange My div tags?
			       
			       			       
			   
			       
			           How do I sort my code (by method name) in Visual Studio 2008?
			       
			       			       
			   
			   

			   
				
				
				
				  .itdaan_shufu { width:300px;height:600px }
				  @media (max-width: 600px) { .itdaan_shufu { display: none; } }
				
				
				     (adsbygoogle = window.adsbygoogle || []).push({});

#3


2  

If you are using Aptana Studio :

如果你正在使用Aptana工作室:

Go to Window > Preferences > Aptana Studio > Validation > HTML.

到窗口>偏好> Aptana Studio >验证> HTML。

Change the two checks by "HTML Tidy Validator" into "X". Alternatively, you could click "+" to add a regular expression to filter out the error.

通过“HTML Tidy Validator”将这两个检查更改为“X”。或者,您可以单击“+”添加正则表达式以过滤掉错误。

#4


0  

This is a fairly old question, but I feel obliged to point a few things out:

这是一个相当古老的问题,但我觉得有必要指出以下几点:

  • Empty elements are acceptable if used correctly. E.g. the javascript templating engine pure.js relies completely on them.
  • 如果使用正确,可以接受空元素。例如,纯javascript模板引擎。js完全依赖它们。
  • In your case ideally you should add the clear:left to element after the floated element, rather than using utility elements. DOM classes should have nothing to do with the css itself (e.g. clear), but rather should describe the document structure (which in turn allows you to clear the logical elements). Either way, that's the ideal world and it's fairly common to use css the way you are using it and there isn't too much wrong with it (the only disadvantage being that you need to change the DOM if you want to change the look of your site).
  • 在理想情况下,应该在浮动元素之后添加clear:left to元素,而不是使用实用程序元素。DOM类应该与css本身无关(例如,clear),而应该描述文档结构(从而允许您清除逻辑元素)。不管怎样,这是理想的世界,使用css的方式是非常常见的,并且没有太多的错误(唯一的缺点是,如果想更改站点的外观,就需要更改DOM)。
  • The worst thing to do is adding &nbsp; as that ignores the reason behind the warning entirely and just 'bypasses' it.
  • 最糟糕的事情莫过于添加因为这完全忽略了警告背后的原因,而只是“绕过”它。

#5


-1  

Try doing this:

试着这样做:

    .clear {
        clear: left;
    }

Happend to me with empty divs written in the same line.

用同样的诗句写着空洞的歌谣。

#6


-2  

Another solution is giving your empty div an id

另一个解决方案是给空div一个id

<div id="myEmptyDiv"></div>

#1


35  

For Aptana Studio users:

Aptana Studio用户:

Windows: go to Window > Preferences > Aptana Studio > Validation

窗口:转到窗口>首选项> Aptana Studio >验证

(Mac: go to Aptana Studio > Preferences > Aptana Studio > Validation)

(Mac:进入Aptana Studio > Preferences > Aptana Studio > Validation)

Select HTML Tidy Validator then some collapse-able options will appear. Select Elements, it will show a list of options. Now go to the bottom of the list and you'll see "Trim Empty Elements": change it from warning to ignore.

选择HTML Tidy Validator,会出现一些可折叠的选项。选择元素,它将显示选项列表。现在转到列表的底部,您将看到“修饰空元素”:将它从警告更改为忽略。

#2


15  

I'm assuming your talking about Aptana Studio maybe some other IDE's do the same thing, I dont know? Any how you can simply add a space between the div tags like so:

我猜你说的是Aptana Studio也许其他IDE也会这么做,我不知道?如何在div标签之间添加空格,比如:

<div id="someDiv" class="clearLeft"> </div>

or add a comment between the tags like this:

或者在标签之间添加这样的注释:

<div id="someDiv" class="clearLeft"><!----></div>

This should remove the warning message and wont cause any issue with your html.

这将删除警告消息,不会对html造成任何问题。

在Aptana Studio中,如何更改我的代码以避免警告“应该删除空白”?[英]How do I change my code to avoid warning “should trim empty ” in Aptana Studio?
			      
			      
			      
			      
			      
			      
			         本文翻译自
			      
			      
			       Joanne Gil
			       查看原文
			      
			       2011-11-12
			       14934 
                  
                      
                     
                     
                     
                     css/
                                          
                     
                     trim/
                                          
                     
                     aptana/
                                          
                     
                     
                     html                     
                     
                  
			        
			          
				        
				      
			      
			      
			          
						
						     (adsbygoogle = window.adsbygoogle || []).push({});
 						
                 
                        
                        
                            I use 'class' when I need CSS function. For example, when I want to use clear: left; I make a class .clear {clear: left;} and use it in HTML file. 
当我需要CSS函数时,我使用class。例如,当我想用clear: left;我创建一个类。clear {clear: left;}并在HTML文件中使用它。 
But there is always the warning 
但警告总是存在的 
 
 should trim empty  
 应该削减空 
 
Luckily, it's not error so I don't care greatly. But it bother me sometimes. 
幸运的是,这不是错误,所以我不太在意。但它有时也困扰着我。 
Is there any solution sticking my habit? 
有什么办法可以坚持我的习惯吗?

     (adsbygoogle = window.adsbygoogle || []).push({});6 个解决方案
                           
                           
							  
							    #1
							    
							      35  
For Aptana Studio users: 
Aptana Studio用户: 
Windows: go to Window > Preferences > Aptana Studio > Validation 
窗口:转到窗口>首选项> Aptana Studio >验证 
(Mac: go to Aptana Studio > Preferences > Aptana Studio > Validation) 
(Mac:进入Aptana Studio > Preferences > Aptana Studio > Validation) 
Select HTML Tidy Validator then some collapse-able options will appear. Select Elements, it will show a list of options. Now go to the bottom of the list and you'll see "Trim Empty Elements": change it from warning to ignore. 
选择HTML Tidy Validator,会出现一些可折叠的选项。选择元素,它将显示选项列表。现在转到列表的底部,您将看到“修饰空元素”:将它从警告更改为忽略。
							     
							                          
                           
							  
							    #2
							    
							      
15  
I'm assuming your talking about Aptana Studio maybe some other IDE's do the same thing, I dont know? Any how you can simply add a space between the div tags like so:  
我猜你说的是Aptana Studio也许其他IDE也会这么做,我不知道?如何在div标签之间添加空格,比如: 
<div id="someDiv" class="clearLeft"> </div>
 
or add a comment between the tags like this: 
或者在标签之间添加这样的注释: 
<div id="someDiv" class="clearLeft"></div>
 
This should remove the warning message and wont cause any issue with your html. 
这将删除警告消息,不会对html造成任何问题。 

							     
							                          
                           
							  
							    #3
							    
							      
2  
If you are using Aptana Studio : 
如果你正在使用Aptana工作室: 
Go to Window > Preferences > Aptana Studio > Validation > HTML. 
到窗口>偏好> Aptana Studio >验证> HTML。 
Change the two checks by "HTML Tidy Validator" into "X". Alternatively, you could click "+" to add a regular expression to filter out the error. 
通过“HTML Tidy Validator”将这两个检查更改为“X”。或者,您可以单击“+”添加正则表达式以过滤掉错误。
							     
							                          
                           
							  
							    #4
							    
							      
0  
This is a fairly old question, but I feel obliged to point a few things out: 
这是一个相当古老的问题,但我觉得有必要指出以下几点: 
Empty elements are acceptable if used correctly. E.g. the javascript templating engine pure.js relies completely on them. 
 如果使用正确,可以接受空元素。例如,纯javascript模板引擎。js完全依赖它们。 
 In your case ideally you should add the clear:left to element after the floated element, rather than using utility elements. DOM classes should have nothing to do with the css itself (e.g. clear), but rather should describe the document structure (which in turn allows you to clear the logical elements). Either way, that's the ideal world and it's fairly common to use css the way you are using it and there isn't too much wrong with it (the only disadvantage being that you need to change the DOM if you want to change the look of your site). 
 在理想情况下,应该在浮动元素之后添加clear:left to元素,而不是使用实用程序元素。DOM类应该与css本身无关(例如,clear),而应该描述文档结构(从而允许您清除逻辑元素)。不管怎样,这是理想的世界,使用css的方式是非常常见的,并且没有太多的错误(唯一的缺点是,如果想更改站点的外观,就需要更改DOM)。 
 The worst thing to do is adding &nbsp; as that ignores the reason behind the warning entirely and just 'bypasses' it. 
 最糟糕的事情莫过于添加因为这完全忽略了警告背后的原因,而只是“绕过”它。 

							                          
                           
							  
							    #5
							    
							      
-1  
Try doing this: 
试着这样做: 
    .clear {
        clear: left;
    }
 
Happend to me with empty divs written in the same line. 
用同样的诗句写着空洞的歌谣。
							     
							                          
                           
							  
							    #6
							    
							      
-2  
Another solution is giving your empty div an id  
另一个解决方案是给空div一个id 
<div id="myEmptyDiv"></div>

							     
							                          
                           
                        
                 
               
				
				     (adsbygoogle = window.adsbygoogle || []).push({});
				
			     
			     		     
			     
			         
		              ×
		              注意!
		              
		              本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/11/12/3d1f658eb02630c4f362408b49a7e024.html。
		              
		              
		            	
		            
			
		    
		          
		          
			          
				          
					      timeout_show();
					      			
			
			
			  
			   
			   
			   
			       
			           How do I avoid rebuilding my database everytime I make a change to my Windows Workflow
			       
			       			       
			   
			       
			           How do I turn off automatic updates in Aptana Studio for Eclipse?
			       
			       			       
			   
			       
			           Recompile my code with -Xlint:unchecked.After recompiling with -Xlint , unchecked call warning appears . how do i run my program now? 
			       
			       			       
			   
			       
			           How do I change my password in Linux? 
			       
			       			       
			   
			       
			           how do I avoid my placeholder to be in uppercase in Internet Explorer 9
			       
			       			       
			   
			       
			           How do I avoid a race condition in my Rails app?
			       
			       			       
			   
			       
			           How do I avoid that my App enters optimization on Samsung devices
			       
			       			       
			   
			       
			           How do I trim a hash?
			       
			       			       
			   
			       
			           How Do I Arrange My div tags?
			       
			       			       
			   
			       
			           How do I sort my code (by method name) in Visual Studio 2008?
			       
			       			       
			   
			   

			   
				
				
				
				  .itdaan_shufu { width:300px;height:600px }
				  @media (max-width: 600px) { .itdaan_shufu { display: none; } }
				
				
				     (adsbygoogle = window.adsbygoogle || []).push({});

#3


2  

If you are using Aptana Studio :

如果你正在使用Aptana工作室:

Go to Window > Preferences > Aptana Studio > Validation > HTML.

到窗口>偏好> Aptana Studio >验证> HTML。

Change the two checks by "HTML Tidy Validator" into "X". Alternatively, you could click "+" to add a regular expression to filter out the error.

通过“HTML Tidy Validator”将这两个检查更改为“X”。或者,您可以单击“+”添加正则表达式以过滤掉错误。

#4


0  

This is a fairly old question, but I feel obliged to point a few things out:

这是一个相当古老的问题,但我觉得有必要指出以下几点:

  • Empty elements are acceptable if used correctly. E.g. the javascript templating engine pure.js relies completely on them.
  • 如果使用正确,可以接受空元素。例如,纯javascript模板引擎。js完全依赖它们。
  • In your case ideally you should add the clear:left to element after the floated element, rather than using utility elements. DOM classes should have nothing to do with the css itself (e.g. clear), but rather should describe the document structure (which in turn allows you to clear the logical elements). Either way, that's the ideal world and it's fairly common to use css the way you are using it and there isn't too much wrong with it (the only disadvantage being that you need to change the DOM if you want to change the look of your site).
  • 在理想情况下,应该在浮动元素之后添加clear:left to元素,而不是使用实用程序元素。DOM类应该与css本身无关(例如,clear),而应该描述文档结构(从而允许您清除逻辑元素)。不管怎样,这是理想的世界,使用css的方式是非常常见的,并且没有太多的错误(唯一的缺点是,如果想更改站点的外观,就需要更改DOM)。
  • The worst thing to do is adding &nbsp; as that ignores the reason behind the warning entirely and just 'bypasses' it.
  • 最糟糕的事情莫过于添加因为这完全忽略了警告背后的原因,而只是“绕过”它。

#5


-1  

Try doing this:

试着这样做:

    .clear {
        clear: left;
    }

Happend to me with empty divs written in the same line.

用同样的诗句写着空洞的歌谣。

#6


-2  

Another solution is giving your empty div an id

另一个解决方案是给空div一个id

<div id="myEmptyDiv"></div>