当前位置: 首页 > news >正文

网站是如何做的自己弄公司网站

网站是如何做的,自己弄公司网站,网易考拉的网站建设,成都游戏软件开发公司有哪些我有body {background: url(images/background.svg);}期望的效果是该背景图像的宽度等于页面的宽度#xff0c;高度变化以保持比例。 例如 如果原始图像恰好是100 * 200(任何单位)且正文宽度为600px#xff0c;则背景图像最终应为1200px高。 如果调整窗口大小#xff0c;高度…我有body {background: url(images/background.svg);}期望的效果是该背景图像的宽度等于页面的宽度高度变化以保持比例。 例如 如果原始图像恰好是100 * 200(任何单位)且正文宽度为600px则背景图像最终应为1200px高。 如果调整窗口大小高度应自动更改。 这可能吗目前Firefox看起来正在调整高度然后调整宽度。 这可能是因为高度是最长的尺寸而且它试图避免裁剪 我想垂直裁剪然后滚动没有水平重复。此外即使明确指定background-repeat:repeatChrome也会将图像置于中心位置不会重复无论如何都是默认值。html, body { height: 100%; }有帮助吗 还有咳嗽。这有一个CSS3属性即background-size(兼容性检查)。虽然可以设置长度值但它通常与特殊值contain和cover一起使用。在您的特定情况下您应该使用coverbody {background-image:    url(images/background.svg);background-size:     cover;                      /* background-repeat:   no-repeat;background-position: center center;              /* optional, center the image */}eggplanation为contain和cover对不起的双关语感到抱歉但我将使用Biswarup Ganguly当天的照片进行演示。让我们说这是你的屏幕灰色区域在你的可见屏幕之外。为了演示我将假设一个16x9的比例。我们想用上面提到的图片作为背景。但是出于某种原因我们将图像裁剪为4x3。我们可以将background-size属性设置为某个固定长度但我们将关注contain和cover。请注意我还假设我们没有破坏body的宽度和/或高度。containcontainScale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.这样可以确保背景图像始终完全包含在背景定位区域中但是在这种情况下可能会有一些空白空间填充background-colorcovercoverScale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.这可以确保背景图像覆盖所有内容。没有可见的background-color但是根据屏幕的比例图像的很大一部分可能会被切断用实际代码演示div div {background-image: url(http://i.stack.imgur.com/r5CAq.jpg);background-repeat: no-repeat;background-position: center center;background-color: #ccc;border: 1px solid;width: 20em;height: 10em;}div.contain {background-size: contain;}div.cover {background-size: cover;}/********************************************Additional styles for the explanation boxes*********************************************/div div {margin: 0 1ex 1ex 0;float: left;}div div {clear: both;border-top: 1px dashed silver;padding-top:1ex;}div div::after {background-color: #000;color: #fefefe;margin: 1ex;padding: 1ex;opacity: 0.8;display: block;width: 10ex;font-size: 0.7em;content: attr(class);}Note the grey background. The image does not cover the whole region, but its fully contained.Note the ducks/geese at the bottom of the image. Most of the water is cut, as well as a part of the sky. You dont see the complete image anymore, but neither do you see any background color; the image covers all of the .这正是我想要的谢谢。它似乎不适用于Chrome(或至少Chromium) - 有任何好主意吗根据quirksmode.org/css/contents.html#t44它应该在Chrome中工作没有任何前缀。但是您尝试过-webkit-前缀吗Yauhen的答案(在本页底部)实际上是我在寻找的background-size: containDannyBeckett虽然这是可能的但它不是OP想要的我想垂直裁剪然后滚动没有水平重复。DannyBeckett新版本现在应涵盖所有相关问题。毕竟我之前的回答是相当微小的。contain就像缩放适合。 cover就像缩放填充。 contain调整图像大小以匹配宽度和高度之间的较大尺寸。 cover调整图像大小以匹配宽度和高度之间的较小尺寸。Zeta抱歉我的错误我混淆了两个边框蓝色和红色边框。基于来自https://developer.mozilla.org/en-US/docs/CSS/background-size的提示我最终得到了以下对我有用的配方body {overflow-y: hidden ! important;overflow-x: hidden ! important;background-color: #f8f8f8;background-image: url(index.png);/*background-size: cover;*/background-size: contain;background-repeat: no-repeat;background-position: right;}虽然我使用background-position: center;但这对我来说比backgound-size: cover;更好。我可以知道为什么我们需要overflow-y: hidden部分吗我不确定你到底在寻找什么但是你真的应该看看Chris Coyier写的CSS-Tricks的这些优秀博客文章阅读每篇文章的描述看看它们是否符合您的要求。第一个回答了以下问题Is there a way to make a background image resizeable? As in, fill the background of a web page edge-to-edge with an image, no matter the size of the browser window. Also, have it resize larger or smaller as the browser window changes. Also, make sure it retains its ratio (doesnt stretch weird). Also, doesnt cause scrollbars, just cuts off vertically if it needs to. Also, comes in on the page as an inline tag.第二篇文章的目标是获得以下内容网站上的背景图像始终覆盖整个浏览器窗口。希望这可以帮助。试试这个element.style {background: rgba(0, 0, 0, 0) url(img/shopping_bgImg.jpg) no-repeat scroll center center / cover;}背景图像不是设置完美然后他的CSS是问题创建所以他的CSS文件更改为下面的代码html {background-image: url(example.png);background-repeat: no-repeat;background-position: 0% 0%;background-size: 100% 100%;}; background-size100100;只需添加以下一行.your-class {height: 100vh;}vh是视口高度。这将自动缩放以适合设备的浏览器窗口。在这里查看更多使div为浏览器窗口的100高度body{background-image: url(../url/imageName.jpg);background-attachment: fixed;background-size: auto 100%;background-position: center;}描述问题究竟是什么以及如何解决它请不要在没有解释的情况下粘贴一堆代码。我遇到了同样的问题在调整浏览器尺寸时无法调整图像大小。坏代码html {background-color: white;background-image: url(example.png);background-repeat: no-repeat;background-attachment: scroll;background-position: 0% 0%;}好代码html {background-color: white;background-image: url(example.png);background-repeat: no-repeat;background-attachment: scroll;background-position: 0% 0%;background-size: contain;}这里的关键是添加这个元素 - background-sizecontains;这对我有用background-size: auto 100%;设置背景大小没有帮助以下解决方案对我有用.class {background-image: url(blablabla.jpg);/* Add this */height: auto;}它基本上会裁剪图像并使其适合background-size: contain/cover仍然不适合。
http://www.yutouwan.com/news/175542/

相关文章:

  • 自己怎么建立自己的国际网站宁波搭建网站
  • 城市建设理论研究收录网站建筑设计理念万能模板
  • 容桂医疗网站建设seo就业指导
  • 大莲网站建设公司ps做网站框架搭建
  • 周村有做网站广告的吗怎么开通网站
  • 免费网站平台推荐小程序登录注册
  • 三亚网络网站建设西安seo外包行者seo
  • 网站建设域名怎么选择东莞电商网站公司
  • pycharm做网站网页是由什么语言编程的
  • 天津市政建设集团有限公司网站网站后台登陆网址是多少
  • 安新seo优化排名网站国家企业信息信用信息公示网山东
  • 网站开发费属于无形资产企业网站 建设流程
  • 织梦cms做网站做网站怎么打空格
  • .net 网站 源代码wordpress 移动页面 自动跳转
  • 中国建设银行网站的社保板块在哪当阳网站建设
  • 做网站内容都有哪些网站建设 电商
  • 南浔哪有做网站的网页设计站点建设实验报告
  • 网站建设安全架构做网站服务器配置应该怎么选
  • 沈阳创新网站建设报价网站开发工程师所需要的经验
  • 新网建站教程wordpress 腾讯地图插件
  • 织梦多网站代运营是什么意思
  • 深圳住房和建设局官网网站网站建设阿里云
  • 网站 设计 语言上海php网站开发公司
  • 做网站设计注意什么细节北京王府井在几环
  • php做视频网站源码让Wordpress拒绝pc访问
  • 天津网站维护保定电子网站建设
  • 做的好点的外贸网站有哪些网站自己做需要多少钱
  • 重点学科网站建设建筑公司注册条件
  • 快刷网站visual studio网站开发教程
  • 网站首页做后台链接老外做的中国方言网站