Home > Web Front-end > HTML Tutorial > About content layout in Div_html/css_WEB-ITnose

About content layout in Div_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:26:26
Original
934 people have browsed it

首先在Div中高度固定 宽度自动 里面添加文字  如图:
如果文字过长就自动扩充宽度达到如下图所示:
希望能给出代码 谢谢


回复讨论(解决方案)

在线等 求助 本人刚毕业菜鸟 弄JAVA  对前台不是很熟悉





首页




 


 <script> <br>      function check() { <br>          document.getElementById("d1").innerHTML = document.getElementById("txt").value; <br>          var str = document.getElementById("d1").innerHTML.toString(); <br>          if (str.length > 10) { <br>              document.getElementById("d1").style.width = "300px"; <br>          } <br>          else { <br>              document.getElementById("d1").style.width = "50px"; <br>          } <br>      } <br> </script>
 


 
 
 
 
 
 
 
 
希望对你有帮助





首页




 
& lt; script & gt;
Function Check () {
document.GetelementByid ("d1").
VAR STR = document.getElementById("d1").innerHTML.toString();
                                                                                         >                                                                                                                                                                                                                 . /script>

< ;/body> >


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template