如何为可变高度的div设置背景?

发布于 2024-09-16 06:09:09 字数 199 浏览 2 评论 0原文

alt text

刚刚完成我的大学项目,我想放置一个背景图像作为 div 背景。 div 位于右侧,即“主要内容”区域。

在哪里可以找到笔记本类型的背景图像来模拟课本中的表格?另外,我如何解释表格的可变高度?只是拉伸图像吗?

有教程吗?

alt text

Just finishing up my college project and I want to place a background image as the div background. The div is on the right hand side, the 'main content' area.

Where can I find a notebook type background image to simulate that the forms are in a textbook? Also, how can I account for variable height of the forms? Just stretch the image?

Any tutorials?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

涙—继续流 2024-09-23 06:09:09

你可以尝试 css background-repeat 属性并确保创建一个可以重复的图像......

u can try css background-repeat property and make sure to create an image which can be repeated...

昨迟人 2024-09-23 06:09:09

实际上你需要两张图像,一张图像将重复并作为背景,第二张图像将保留在右侧或左侧或顶部或底部,无论你喜欢它......让它工作你需要两个 div,一个外部,一个内部......这是它的 css

.blueout{width:650px;
margin-left:0;
margin-top:10px;
background:#fff url(images/repeated-background.gif) repeat-y left top;
padding-left:20px;
}
.bluein{
background:#fff url(images/corner1.jpg) right top no-repeat;
padding:1em 1em 1em 0;
}

,这是它​​的 html......

<div class="blueout">
<div class="bluein">

<p>some text here</p>

</div>
</div>

repeat-y 意味着它将向 y 轴(垂直)重复,你可以将其更改为水平,这取决于您的背景切片......

希望这有帮助......

Actually you need two image, one image will repeat and make the background, the second image will stay on the right side or left or top or bottom whereever you like it...........to make it work you will need two divs, one outer and one inner..... here is the css for that to work

.blueout{width:650px;
margin-left:0;
margin-top:10px;
background:#fff url(images/repeated-background.gif) repeat-y left top;
padding-left:20px;
}
.bluein{
background:#fff url(images/corner1.jpg) right top no-repeat;
padding:1em 1em 1em 0;
}

and here is the html for it....

<div class="blueout">
<div class="bluein">

<p>some text here</p>

</div>
</div>

repeat-y means it will repeat towards y-axis (vertically) you can change it to horizontal it depends on your slice for background.....

Hope this helps....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文