【发布时间】:2012-01-30 06:41:16
【问题描述】:
http://i.stack.imgur.com/FZyiq.jpg 我已经设计了这个布局,并且在我看来它工作得很好,但是当我尝试用 CSS 来做这个时,事情变得有点奇怪。
我有一个宽度为 960 像素的 div,这个 div 是主要的内容包装器。我希望这个画廊 div 忽略宽度并拥有 100% 的浏览器分辨率(或其他宽度)。知道怎么做吗?
<div id="conteudo" >
<div class="exploded-wrapper" id="your_post_here_<?php the_ID(); ?>">
<div class="exploded" id="your_post_here_<?php the_ID(); ?>">
<a href="javascript:jQuery('.exploded-wrapper').hide();jQuery('.exploded').hide();" class="close"></a>
<div class="detalhes">
<div class="desc_wrapper">
<div class="desc">
<h2>
<?php the_title(); ?>
</h2>
<?php echo the_excerpt(); ?>
<div class="desc_pag">
<!--a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a-->
</div>
</div>
</div>
<div class="galeria">
<?php the_content('Read the rest of this entry »'); ?>
<script type="text/javascript">
jQuery(document).ready(function() {
// Using default configuration
//$("#galeria").carouFredSel();
// Using custom configuration
jQuery("#galeria").carouFredSel({
//items : 2,
circular : true,
direction : "left",
infinite : true,
scroll : {
items : 1,
easing : "swing",
pauseOnHover : true,
mousewheel : true
}
});
});
</script>
</div>
</div>
</div>
</div>
</div>
对于 CSS,请使用 firebug 并检查 http://ccrdesign.com/portifolio/
【问题讨论】:
-
使用位置:绝对;将其从文档流中取出,宽度 100% 应使浏览器窗口的宽度达到完整。
-
快速浏览了一下,虽然我没有立即找到解决方案,但我确实注意到您正在重复使用元素 ID。 ID 必须是唯一的;您应该将重用的改成类,并相应地调整任何脚本。
-
@KyleSevenoaks 你指的“它”是什么?此外,100% 的宽度只会使其与其父级一样宽,而不是浏览器窗口(除非父级也是那么宽或文档是父级)。我会查看提供的链接,看看你是否可以让它工作,并将其作为实际答案而不是评论提供......如果你解决了它,请抓住一些赞成和接受的答案!
-
@Greg,我只是提出一些建议。我确实知道 SO 是如何工作的:D 也许我会仔细看看... :) Thiago:您提供的链接,CSS 没有正确链接或其他什么,它没有样式。
-
既然已经知道要忽略 960px,为什么还要 960px 宽的 div?或者你的意思是你想让固定宽度的 div 有一个滚动条?
标签: html css width fixed-width