可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

I'm working on the website and I'm trying to make it responsive to all resolutions but without success..

Here is HTML:

Lorem ipsum nasov je?

"Lorem ipsum dolor sit amet, consectetur adipisicing elit."

And here is css:

body

{

width:1920px;

background-color: #f8e0b3;

height:1080px;

}

div.container

{

width:100%;

height:100%;

}

div.header

{

background:url(img/header.jpg);

width:100%;

height:46%;

margin-top:;

margin-left:;

border-bottom: 2px solid black;

}

h1.naslov

{

font-size:60px;

color:white;

margin:0 auto;

margin-left:28%;

font-family: Aramis;

}

p.naslov-text

{

font-size:40px;

color:#634ea9;

margin:0 auto;

width:1000px;

margin-top:0%;

margin-left:36%;

font-family: Aramis;

}

When I resize my browser website doesn't resize. I've been trying all morning and I'm really burnout. Do anyone know what logic to approach to make this fit all screens , but only using css.

回答1:

As you are giving a fixed width to your body and p.naslov-text, your website will not resize. Remove all px sizing and replace them with percentage values.

But if you want fixed sizes and also responsive you must use css media queries like that:

body

{

width:1920px;

background-color: #f8e0b3;

height:1080px;

}

@media screen and (min-width: 500px) {

body {

width:420px;

}

}

@media screen and (min-width: 800px) {

body {

width:720px;

}

}

回答2:

CSS:

#gallery-1 img {

width:375px;

}

@media screen and (min-width: 1366px) {

#gallery-1 img {width:375px;}

}

@media screen and (min-width: 1440px) {

#gallery-1 img {width:428px;}

}

@media screen and (min-width: 1600px) {

#gallery-1 img {width:434px;}

}

@media screen and (min-width: 1920px) {

#gallery-1 img {width:540px;}

}

Reference: Stack Over Flow

JQUERY:

Use jquery for resize window. This one is dynamic code for window resizing for all browsers.

Example code here using jquery:

$(document).ready(function(){

$(window).resize();

});

$(window).resize(function{

// your code

var windowWidth=$(window).width();

var mainContainerWidth=windowWidth-100; // For example

$("#yourMainContainer").css({"width":mainContainerWidth+"px"});

});

like that you will try for your main class width and height.

回答3:

You have a fixed width on your body

回答4:

Remove width (in "px") from body and also from p.naslov-text. Try to give width:100%; to get responsive layout Fiddle

CSS:

body {

background-color: #f8e0b3;

height:1080px;

width:100%;

}

p.naslov-text {

font-size:40px;

color:#634ea9;

margin:0 auto;

margin-top:0%;

margin-left:36%;

font-family: Aramis;

}

回答5:

Hope this helps..

FIDDLE

CSS

body

{

width:100%;

background-color: #f8e0b3;

height:100%;

}

div.container

{

width:100%;

height:100%;

}

div.header

{

background:url(img/header.jpg);

width:100%;

height:100%;

margin: 2% 2% 2% 2%;

border-bottom: 2px solid black;

}

h1.naslov

{

font-size:60px;

color:white;

margin:0 auto;

float:none;

font-family: Aramis;

}

p.naslov-text

{

font-size:40px;

color:#634ea9;

margin:0 auto;

margin-top:0%;

float:left;

font-family: Aramis;

}

Also try to use media Query for whatever resolution you want..

回答6:

hello you should use @media screen in your css and you should use % instead px.

@media screen and (min-width: 1366px) {

#gallery-1 img {width:375px;}

}

@media screen and (min-width: 1440px) {

#gallery-1 img {width:428px;}

}

@media screen and (min-width: 1600px) {

#gallery-1 img {width:434px;}

}

@media screen and (min-width: 1920px) {

#gallery-1 img {width:540px;}

}

css标签resolution,html/css to fit all screen resolution相关推荐

  1. css标签不换行,CSS不换行与CSS换行

    DIV CSS换行_DIV CSS不换行_CSS文字换行_css换行,css不换行案例讲解 通过css可以使对应div标签内的文字换行或不换行设置操作,通过不同CSS样式对文字样式设置-css文字. ...

  2. SAP UI5 应用开发教程之三十六 - 使用 Chrome 开发者工具 Elements 标签动态修改 CSS 类试读版

    一套适合 SAP UI5 初学者循序渐进的学习教程 教程目录 SAP UI5 本地开发环境的搭建 SAP UI5 应用开发教程之一:Hello World SAP UI5 应用开发教程之二:SAP U ...

  3. div css标记,前端初学者必学的div加css标签

    原标题:前端初学者必学的div加css标签 今天给大家分享前端初学者必须要学习的标签,这些标签你都会了吗? DIV加css标签 页头:header 登录条:loginBar 标志:logo 侧栏:si ...

  4. 史上最全的HTML和CSS标签常用命名规则

    文件夹主要建立以下文件夹: 1.Images 存放一些网站常用的图片: 2.Css 存放一些CSS文件: 3.Flash 存放一些Flash文件: 4.PSD 存放一些PSD源文件: 5.Temp 存 ...

  5. [css] 标签、class和id选择器三者的区别是什么?分别在什么时候用?

    [css] 标签.class和id选择器三者的区别是什么?分别在什么时候用? 标签选择器:tag{} 选取对应的标签例如 a span div class选择器:.class-name{} 选取对应c ...

  6. before css 旋转_单标签!纯CSS实现动态晴阴雨雪

    引言 本期分享一下如何仅用CSS3,实现单标签的动态晴阴雨雪.技术关键点就是"单标签"和"纯CSS".先看下最终效果: 再看看HTML代码: <div c ...

  7. CSS标签选择器(二)

    一.CSS选择器概述 1.1.CSS功能 CSS语言具有两个基本功能:匹配和渲染 当浏览器在解析CSS样式时,首先应该确定哪些元素需要渲染,即匹配哪些HTML元素,这个操作由CSS样式中的选择器负责标 ...

  8. html a标签 onload,动态加载script和css标签的onload问题

    在firefox下,动态加载script标签和css标签,是可以简单地监听onload事件的,但在ie下,监听onload事件无效.为了解决这个问题,可以改用监听onreadystatechange, ...

  9. CSS 标签诡异添加 injected stylesheet

    injected stylesheet css的一个异常标签,今天出现一个非常诡异的事情,就是在css标签里面,我并没有添加 injected stylesheet   这类的属性反而在有些电脑上会自 ...

最新文章

  1. 爬虫-selenium初步学习与使用!
  2. 边缘触发(Edge Trigger)和条件触发(Level Trigger)
  3. Django(part16)--URL反向解析
  4. 前端学习(1884)vue之电商管理系统电商系统之实现侧边栏的折叠和展开
  5. C++ struct和class的区别
  6. Android项目运行junit测试类时出现错误Internal Error (classFileParser.cpp:3494)的解决办法...
  7. 如何找到字符串中的最长回文子串?
  8. Eclipse启动无响应,停留在Loading workbench状态
  9. Google 74版本上传附件没有“选择文件”按钮
  10. 24.磁盘配额(Quota)
  11. office起动缓慢_win7系统打开Office2013很慢的解决方法
  12. 沟通CTBS物流行业远程接入解决方案
  13. 程序人生之六:写在 2010 年最后一晚,我这两年的工作总结
  14. A4纸网页打印中对应像素的设定和换算
  15. 为什么SecureCRT里无法输入?
  16. FileUploadException: Stream closed
  17. 未来WiFi技术新方向:传输、覆盖、能耗
  18. C++ 调用 Python 代码 - Clion QT混合编程 ,各取长处。
  19. matlab并联lc谐振电路图,串联谐振和并联谐振LC电路操作
  20. win10用户账户控制怎么取消或打开

热门文章

  1. 向极限挑战:算术编码 (转)
  2. 解决 No projects are available for deployment to this server!
  3. 谁说菜鸟不会数据分析--读书笔记
  4. Asp.NetWebForm的控件属性
  5. 将试用版visual studio 2008升级为正式版 --更新
  6. 高效的序列化/反序列化数据方式 Protobuf
  7. 持续集成与持续部署宝典Part 2:创建持续集成流水线
  8. 嵌套集合模型(Nested set model)介绍
  9. 安装开源 ITIL 门户 iTOP
  10. (五)Maven中的聚合和继承