本文介绍了垂直居中图像......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! .. 我尝试尽可能使用CSS,虽然我还在学习并且不能最大限度地使用它。 特别是,我仍然使用表格在一些幻灯片中提供居中的图像(虽然表格垂直对齐在Mozilla中不起作用): http://zintel.com/homepics.html 我已经使用< center>,style align''center'',table cell align,valign和height ='''100%'的组合来得到我想要的东西,但我想知道CSS是否可以单独完成。 我已经尝试过CSS将图像沿着水平和垂直方向居中对齐,但是如果可能的话,它将无法垂直对齐(我假设我可以通过获取图片宽度和高度以及绝对值来实现定位,但似乎我应该让浏览器使用样式对齐属性执行此操作) 什么是对齐图像horizo​​ntall的最佳方法y并使用CSS在可用的windowspace中垂直移动? zin - http://www.zintel.com..I try to use CSS when possible, though I am still learning and don''t maximize its use.In particular, I still use a table to provide for a centered image in a few slideshows (though table vertical align doesn''t work in Mozilla): http://zintel.com/homepics.htmlI''ve used combinations of <center>, style align ''center'', table cell align, valign and height=''100%'' to get what I want, but I wonder if CSS can do it by itself.I''ve tried CSS to align images centrally along the horizontal and vertical but get nowhere vertically, should that be possible (I assume I could do it with a fetch of pic width and height and absolute positioning, but it seems I should let the browser do that with a style align property)What would be the best way to align an image horizontally and vertically within the available windowspace using CSS?zin-- http://www.zintel.com推荐答案 不是几个版本,我会试试。 我说的是单个单元格中的中心图像(大小不同) 的全窗口大小的表格,或者是一个紧密包裹的中心表格 一个单元格中的图像,无论哪种方式,我都得到一个完全窗口/文档中心 图像(虽然我更喜欢紧包装版本,因为我有一个简单的 的阴影效果)。 我在IE中工作的唯一组合是使用< table height ='' 100%'...>这似乎对我的Mozilla不起作用,并不奇怪 ,因为规格中似乎缺少表格高度属性,所以表格 保持在窗口的顶部中心。我可能错过了一些组合, 我会写一个小的test_table html程序然后再试一次。 我使用: < table height ='''100%''width ='''100%''border =''0''> < tr> < td align ='''''''''''''''''''''''''''$ $ $ $ $ 和一个img标签没有对齐说明符,它给了我一个集中的 IE中的图像和Mozilla中的顶级图像。在各个地方使用各种风格 属性并不适合我,但我会再给它一个 。Not for a few versions, I''ll try it.I''m speaking of centered images (of differing sizes) in the single cellof a full-window-size table, or a centered table with tight-wrapping of animage within a cell, either way I get a completely window/document centeredimage (though I''d prefer the tight-wrapped version because I have a simpledrop-shadow effect for that one).The only combination I''ve got to work in IE is when using a <tableheight=''100%''...> which appears to not work on my Mozilla, not surprisingsince the table height attribute seems missing in the spec, and so the tablestays at the top center of the window. I may have missed some combination,I''ll write a small test_table html program and try again.I use:<table height=''100%'' width=''100%'' border=''0''><tr><td align=''center'' valign=''middle''>and an img tag w/ no alignment specifiers, which gives me a centeredimage in IE and a top-centered image in Mozilla. The use of various styleattributes in various places didn''t work for me, but I''ll give it a goagain. 您的CSS版本 Rocky Point对我来说根本不起作用 - 也许是因为当我查看源码时它充满了Javascript。 Your "CSS version" of Rocky Point did not work at all for me -- perhaps because when I view source it was full of Javascript. 对不起!在我的初期,CSS使用Javascript。名字我 意味着我用一个主要使用CSS进行定位的版本替换了早期的FRAMES版本(它取代了之前的 TABLES版本)。我会 更改标识符,谢谢。 如果您要链接到JavaScript版本和CSS版本同样的事情,两者都有JavaScript似乎有点多了!Sorry! To me in my infancy, CSS goes with Javascript. By the name Imeant that I replaced an earlier FRAMES version (which replaced an earlierTABLES version) with a version that uses mostly CSS for positioning. I''llchange the identifier, thanks. If you''re going to link to a JavaScript version and a CSS version of the same thing, it seems a bit much to have JavaScript in both! 疯狂我知道。这些只是链接的原始名称,我没有回头重新考虑什么叫他们因为我已经升级了现在 我的第5版一个幻灯片,从纯IE的javascript与 表和最小控件,到帧到css到[据称]跨浏览器, 全屏,缩放广泛的可拖动/可隐藏菜单和多个 文件夹。我应该将它们全部移动到另一个单独的幻灯片页面,在这里我可以详细描述它们,或者只是将它们全部删除一个好的 跨浏览器版本。更多事情...... 当我说跨浏览器时,我可以测试的是IE5,Mozilla 1.4和 Netscape 7。 /> zinCrazy I know. These are simply the original names of the links, Ihaven''t gone back to reconsider what to call them as I''ve upgraded with nowmy 5th version of a slideshow which went from pure IE javascript with atable and minimal controls, to frames to css to [allegedly] cross-browser,full-screen, zoom with an extensive draggable/hideable menu and multiplefolders. I should move them all to another separate slideshow page where Ican describe them all in detail, or just drop them all for one goodcross-browser version. More to do...And when I say cross-browser, all I can test on is IE5, Mozilla 1.4 andNetscape 7.zin 这篇关于垂直居中图像......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 16:16