html背景图片过大时显示问题,求助_html/css_WEB-ITnose
css html 背景图片 不同分辨率 自适应
情况是这样的,老板给了一张效果图,大小是2186 x 1059的,现在老板的需求是,当屏幕分辨率较小的时候,只显示中间不主要内容,但当屏幕分辨率较大,根据分辨率显示跟着变大回复讨论(解决方案)
设置background为center
你试试写两个div层,设置效果图的top,left为动态的,当分辨率小时,利用其中一个层将超出的部分遮罩起来,具体的top,left为多少 个人认为需要你的分辨率范围去计算了
叫老板去死吧。。。
叫老板去死吧。。。 这也太牛了
设置background为center
这样就行了~~background-position: center top
<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style>div,body,html {margin:0;width:100%;height:100%}.main{background:url(http://news.mydrivers.com/img/20080628/07552404.jpg) no-repeat; background-position:top center;}</style></head><body><div class="main"></div></body></html>
用这样的
楼上几个办法都不错,作为背景实现,还可以用下面方法实现:
css:
.div{ position:relative; width:1000px;}
.div2{ position:absolute; left:-593px; top:0px;}
html:

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.
