我有三个垂直对齐的 div 相互重叠。顶部和底部只是在播放器的顶部和底部显示一个图像。因此协调就变成了这样
<div>
<img>top</img>
<div>
<div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<img>bottom</img>
</div>
现在在其顶部和底部的中间 div 之间有白线/空间。但是我明确地将边距和待定和边界设置为零但仍然没有解决方案。
此问题不会出现在 IE6/IE7/IE8 等,但所有其他浏览器。
感谢 bobince,它通过制作 vertical-align:bottom 在顶部图像侧工作,但不适用于底部图像。我想把谁放在首位。
好的,这是详细代码
<div id="top" >
<img alt="topimage" style="vertical-align:bottom">
<xsl:attribute name="src">
<xsl:value-of select="TopImage"/>
</xsl:attribute>
</img>
</div>
<div id="container" style="clear:both;display:block;margin: 0 0 0 0;padding: 0 0 0 0;text-align:left;border:0 none;">
<div id="left" style="margin: 0 0 0 0;padding: 0 0 0 0;float: left;">
<img alt="left image" style="margin: 0 0 0 0;padding: 0 0 0 0;vertical-align:bottom">
<xsl:attribute name="src">
<xsl:value-of select="LeftImage"/>
</xsl:attribute>
</img>
</div>
<div id="flashde260252-c874-4c67-b1aa-64ebe80bb701" style="margin: 0 0 0 0;padding: 0 0 0 0;float:left;border:0;vertical-align:bottom">
<embed id="flashde260252-c874-4c67-b1aa-64ebe80bb7010" height="308" width="512" allowfullscreen="true" wmode="transparent" quality="high" bgcolor="#ffffff" name="flashde260252-c874-4c67-b1aa-64ebe80bb7010" style="margin: 0 0 0 0;padding: 0 0 0 0;" type="application/x-shockwave-flash">
<xsl:attribute name="src">
<xsl:value-of select="Movie"/>
<xsl:text>?flvfile=</xsl:text>
<xsl:value-of select ="Destination"/>
<xsl:text >&lang=e&environment=PROD</xsl:text>
</xsl:attribute>
</embed>
</div>
<div id="rightimage" style="margin: 0 0 0 0;padding: 0 0 0 0;float:left;">
<img alt="rightimage" style="vertical-align:bottom">
<xsl:attribute name="src">
<xsl:value-of select="RightImage"/>
</xsl:attribute>
</img>
</div>
</div>
<!-- <div id="bcontainer" style="margin: 0 0 0 0;padding: 0 0 0 0;text-align:left;border-left:0;border-right:0;border-top:0;border-bottom:0px;border:none;">-->
<div id="bottom" style="clear:both;display:block;margin: 0 0 0 0;padding: 0 0 0 0;vertical-align:top;text-align:left;border:0 none">
<img alt="subscribe" src="IRBBottom.jpg" usemap="#promomap" border="0" style="vertical-align:top">
<xsl:attribute name="src">
<xsl:value-of select="BottomImage"/>
</xsl:attribute>
</img>
</div>
<!-- </div> -->
<div id="toc" style="clear:both;display:block;text-align:left;">
<ol style="list-style:none;font-size:small;font-weight:bold">
<li>* Includes all matches from main pitch, plus selected matches from pitch 2 - see FAQ for details.</li>
<li>** Includes all matches on Finals Day, March 7th from main pitch - see FAQ for details.</li>
<li>*** All matches on main pitch will be live and matches on pitch 2 will be on demand - see FAQ for details.</li>
</ol>
</div>
<map name="promomap">
<area shape="rect" coords="229,46,350,137" href="index.html" alt="Subscribe or Login" title="Subscribe or Login"/>
<area shape="rect" coords="410,47,528,137" href="XXX.html" alt="R Video" title="Ro"/>
</map>
<script type="text/javascript">
<xsl:text disable-output-escaping="yes">
function showMovie(player,movie,endthumb,destination){
var so = new SWFObject(player+'?flvfile='+movie+'&endthumb='+endthumb +'&endlink='+destination,'flashde260252-c874-4c67-b1aa-64ebe80bb7010','512','308','8', '#ffffff', 'high','');
so.addParam('wmode', 'transparent');so.addParam('allowfullscreen', 'true');so.write('flashde260252-c874-4c67-b1aa-64ebe80bb701');
}
</xsl:text>
<xsl:text> showMovie('</xsl:text>
<xsl:value-of select="Player"/>
<xsl:text>','</xsl:text>
<xsl:value-of select="Movie"></xsl:value-of>
<xsl:text>','</xsl:text>
<xsl:value-of select="EndThumb"/>
<xsl:text>','</xsl:text>
<xsl:value-of select="Destination"/>
<xsl:text>');</xsl:text>
</script>
</div>
:) 在设置行高后,现在它可以在除了 IE 的 lol 之外的所有地方工作
最佳答案
只需将顶部和底部 div 的 line-height 属性设置为 0。
示例代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Test</title>
<style type="text/css">
#top {
background-color: #f00;
line-height: 0px;
}
#middle {
background-color: #0f0;
}
#bottom {
background-color: #00f;
line-height: 0px;
}
</style>
</head>
<body>
<div id="top">
<img src="http://i.stackoverflow.com/Content/Img/stackoverflow-logo-250.png"
alt="Stackoverflow" />
</div>
<div id="middle">
<div>This is the first middle div child.</div>
<div>This is the second middle div child.</div>
<div>This is the third middle div child.</div>
</div>
<div id="bottom">
<img src="http://www.gravatar.com/avatar/ae3e50c947379163d74b6de6fa01d509?s=32&d=identicon&r=PG"
alt="Gripsoft avatar" />
</div>
</body>
关于html - 删除垂直 div 之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/582851/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
查看Ruby的CSV库的文档,我非常确定这是可能且简单的。我只需要使用Ruby删除CSV文件的前三列,但我没有成功运行它。 最佳答案 csv_table=CSV.read(file_path_in,:headers=>true)csv_table.delete("header_name")csv_table.to_csv#=>ThenewCSVinstringformat检查CSV::Table文档:http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV/Table.html
我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此
在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这
我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee
我正在检查一个Rails项目。在ERubyHTML模板页面上,我看到了这样几行:我不明白为什么不这样写:在这种情况下,||=和ifnil?有什么区别? 最佳答案 在这种特殊情况下没有区别,但可能是出于习惯。每当我看到nil?被使用时,它几乎总是使用不当。在Ruby中,很少有东西在逻辑上是假的,只有文字false和nil是。这意味着像if(!x.nil?)这样的代码几乎总是更好地表示为if(x)除非期望x可能是文字false。我会将其切换为||=false,因为它具有相同的结果,但这在很大程度上取决于偏好。唯一的缺点是赋值会在每次运行
我使用Nokogiri(Rubygem)css搜索寻找某些在我的html里面。看起来Nokogiri的css搜索不喜欢正则表达式。我想切换到Nokogiri的xpath搜索,因为这似乎支持搜索字符串中的正则表达式。如何在xpath搜索中实现下面提到的(伪)css搜索?require'rubygems'require'nokogiri'value=Nokogiri::HTML.parse(ABBlaCD3"HTML_END#my_blockisgivenmy_bl="1"#my_eqcorrespondstothisregexmy_eq="\/[0-9]+\/"#FIXMEThefoll