English 中文(简体)
CSS 改装集装箱,而不是造成超支
原标题:CSS to resize container, rather than cause overflow

我对安保部有基本知识。

使用超量流动确实是理想的。 炉.是环形,而不是浏览器。 因此,在电话上显示是个问题(特别是使电梯无法进入的电梯)。

可见的溢出物可见于图像中,显然隐藏着我想要的东西。

因此,有可能扩大主干(湿地区)以控制干.,而不是造成过度流入。 白人部分目前停在屏幕边(开车前)

举例来说,要花钱。 其中心。 并且只有在你能够控制的情况下,它才会被抹去。 但是,u只是 right看其他东西的权利。 我非常希望以地雷为中心。

如果有人知道如何做到这一点,请让我知道。 当前的基本概念是:

 <div id="main"> 
     <div id="sidebar"></div>
     <div id="body"></div>
 </div>

enter image description here

这是协会。 NET MVC 3

最佳回答

实现这一点确实很trick,因为没有CSS办法根据子女的内容将母子成分转作生殖,而且 Java也不是直截了当的。

There is a solution though with jQuery using Rune Kaagaards solution to measure text. Basically the mini-script creates a span around your text and measures its width. You can then use it to resize your container:

<script type="text/javascript">
$(function() {
    //define the mini-function to measure text
    $.fn.textWidth = function(){
      var html_org = $(this).html();
      var html_calc =  <span>  + html_org +  </span> 
      $(this).html(html_calc);
      var width = $(this).find( span:first ).width();
      $(this).html(html_org);
      return width;
    };

    //now resize your main container according to the body width. 
    $("#main").css("width", $("#body").textWidth());
    //this would be body + sidebar
    // $("#main").css("width", $("#body").textWidth()+$("#sidebar").textWidth());
});
</script>

解决你在jsfiddle的问题:

问题回答

暂无回答




相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签