使用<jsp:include>引入其他jsp页面的时候,不能自适应当前div的大小(如图),怎么设置就可以自适应?

使用<jsp:include>引入其他jsp页面的时候,不能自适应当前div的大小(如图),怎么设置就可以自适应?,第1张

你这个不是在JSP里控制的,是在样式表里,被引入的JSP文件body必须是以百分比定义的,比如body{width:100%},如果body或其下的顶层DIV被定义成具体的像素值,那么就不可能实现宽度自适应,除非在jsp页面中使用Javascript脚本来控制,将body或顶层DIV的宽度改为100%。因为我没法看页面的html,无法分析得更具体了,但是基本原理就是这个

html5中是通过css3的background-size来控制自适应的。直接在图片代码里面设置style,例如2、要么给图片统一一个class名例如response-img,然后在css文件里面设置这个classhtml5万维网的核心语言、标准通用标记语言下的一个应用超文本标记语言(HTML)的第五次重大修改(这是一项推荐标准、外语原文:W3CRecommendation、见本处参考资料原文内容)2014年10月29日,万维网联盟宣布,经过接近8年的艰苦努力,该标准规范终于制定完成。

<!--给你一个页面布局的样例代码,但愿对你有用-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=iso-8859-1" />

<title>Dynamic Drive: CSS Fixed Layout #2.1- (Fixed-Fixed)</title>

<style type="text/css">

body{

margin:0

padding:0

line-height: 1.5em

}

b{font-size: 110%}

em{color: red}

#maincontainer{

width: 840px/*Width of main container*/

margin: 0 auto/*Center container on page*/

}

#topsection{

background: #EAEAEA

height: 90px/*Height of top section*/

}

#topsection h1{

margin: 0

padding-top: 15px

}

#contentwrapper{

float: left

width: 100%

}

#contentcolumn{

margin-left: 200px/*Set left margin to LeftColumnWidth*/

}

#leftcolumn{

float: left

width: 200px/*Width of left column*/

margin-left: -840px/*Set left margin to -(MainContainerWidth)*/

background: #C8FC98

}

#footer{

clear: left

width: 100%

background: black

color: #FFF

text-align: center

padding: 4px 0

}

#footer a{

color: #FFFF80

}

.innertube{

margin: 10px/*Margins for inner DIV inside each column (to provide padding)*/

margin-top: 0

}

</style>

<script type="text/javascript">

/*** Temporary text filler function. Remove when deploying template. ***/

var gibberish=["This is just some filler text", "Welcome to Dynamic Drive CSS Library", "Demo content nothing to read here"]

function filltext(words){

for (var i=0i<wordsi++)

document.write(gibberish[Math.floor(Math.random()*3)]+" ")

}

</script>

</head>

<body>

<div id="maincontainer">

<div id="topsection"><div class="innertube"><h1>CSS Fixed Layout #2.1- (Fixed-Fixed)</h1></div></div>

<div id="contentwrapper">

<div id="contentcolumn">

<div class="innertube"><b>Content Column: <em>Fixed</em></b><script type="text/javascript">filltext(45)</script></div>

</div>

</div>

<div id="leftcolumn">

<div class="innertube"><b>Left Column: <em>200px</em></b><script type="text/javascript">filltext(15)</script></div>

</div>

<div id="footer"><a href="http://www.dynamicdrive.com/style/">Dynamic Drive CSS Library</a></div>

</div>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/tougao/11310848.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-15
下一篇2023-05-15

发表评论

登录后才能评论

评论列表(0条)

    保存