


Ask for advice! Problem with images automatically adapting to size_html/css_WEB-ITnose
#div_left_sidebar{
margin:10px auto 10px 10px;
border:0px #00ff00 solid;
background: url(images/side_beijing.jpg) #CCC no-repeat left top;
width: 200px;
height:600px;}
The size of side_beijing.jpg is 364X775. How can I make this background image automatically adapt without changing the image size? The size of the div, what should I do if the image size is smaller than the size defined by the div? Thank you for your advice!
Reply to discussion (solution)
background-size: cover;
background-size: cover;
Success, Thank you so much, I have another question,
I have three layers nested in a div_main. How can I achieve the effect of arranging them side by side? Secondly, I used absolute positioning for the three layers but it still doesn’t work. Please advise, thank you!
css code:
#div_main{
padding:0px;
width:1000px;
background:url(images/div_main_beijing.jpg) #CCC no-repeat left top;
margin:20px auto auto auto;
border: 1px #CCC solid;
}
#div_left_sidebar{
margin:10px auto 10px 10px;
border:0px # 00ff00 solid;
background: url(images/side_beijing.jpg) #CCC no-repeat left top;
background-size:cover;
width: 200px;
height:600px;
}
#div_zhongjian_sidebar{
position:absolute;
left:220px;
top:10px;
margin:10px auto 10px auto;
border:0px #00ff00 solid;
background: url(images/zhongjian_beijing.jpg) #CCC no-repeat left top;
background-size:cover;
width: 560px;
height:600px;
}
#div_right_sidebar{
position:absolute;
left:790px;
top:10px;
margin:10px 10px 10px auto;
border: 0px #00ff00 solid;
background: url(images/side_beijing.jpg) #CCC no-repeat left top;
background-size:cover;
width: 200px;
height:600px;
Page code:
Here is the header title
#div_main >div{
float:left;
}
position:absolute; Get away
float:left;
}
position:absolute; Go away
Is this written on a separate line in the style sheet? Sorry, I'm new to css and I don't know much about it. Could you please explain it to me? Thank you!

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

The article explains the HTML 'class' attribute's role in grouping elements for styling and JavaScript manipulation, contrasting it with the unique 'id' attribute.

Article discusses HTML list types: ordered (<ol>), unordered (<ul>), and description (<dl>). Focuses on creating and styling lists to enhance website design.

HTML entities are codes used in HTML to display special characters correctly, ensuring proper rendering across browsers and devices.

Collapsing white space optimizes content by reducing file size, enhancing readability, and ensuring consistent formatting across platforms in web and document processing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
