小编JaP*_*k14的帖子

CSS媒体查询屏幕大小

我目前正在尝试设计一个兼容多种屏幕尺寸的布局.我正在设计的屏幕尺寸如下:

屏幕尺寸:

  1. 640×480
  2. 800×600
  3. 1024×768
  4. 1280x1024(及更大)

我遇到的问题是创建css3媒体查询,以便当窗口的宽度达到其中一个宽度时,我的布局会发生变化.下面是我正在使用的媒体查询的示例,但它不适合我,所以我想知道是否有人可以帮我修复它.

<link rel="stylesheet" type="text/css" media="screen and (max-width: 700px)" href="css/devices/screen/layout-modify1.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 701px) and (max-width: 900px)" href="css/devices/screen/layout-modify2.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 901px)" href="css/devices/screen/layout-modify3.css">
Run Code Online (Sandbox Code Playgroud)

我尝试使用一组新的媒体查询,但它们仍然不适合我.请有人帮忙解释一下我的错误.你们当中有几个人已经尝试过解释,但我没有得到它.新媒体查询显示如下:

<link rel="stylesheet" type="text/css" media="screen and (max-width: 640px)" href="css/devices/screen/layout-modify1.css">

    <link rel="stylesheet" type="text/css" media="screen and (max-width: 800px)" href="css/devices/screen/layout-modify2.css">

    <link rel="stylesheet" type="text/css" media="screen and (max-width: 1024px)" href="css/devices/screen/layout-modify3.css">

    <link rel="stylesheet" type="text/css" media="screen and (max-width: 1280px)" href="css/devices/screen/layout-modify4.css">
Run Code Online (Sandbox Code Playgroud)

html css html5 css3 media-queries

48
推荐指数
2
解决办法
17万
查看次数

在JavaScript函数中名为"undefined"的参数的用途是什么?

在查看jQuery的未压缩源代码时,我偶然发现了一些我不太了解的内容.当创建他们的匿名函数时,他们将undefined作为第二个参数.这是做什么的,为什么他们使用undefined?是否有必要将undefined作为参数放在匿名函数中?以下是我所谈论的一个例子.

(function( window, undefined)  {
  ...code here
})( window );
Run Code Online (Sandbox Code Playgroud)

javascript undefined

17
推荐指数
1
解决办法
1153
查看次数

用于移动设备的html元标记

我有一块html代码,主要是元标记.我正在尝试重新设计移动设备的布局,所以我想知道我使用的元标记是否是移动布局所必需的.代码块如下:

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE-edge,chrome=1">
<title>ConquestRealms - Home</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="cleartype" content="on">
Run Code Online (Sandbox Code Playgroud)

html mobile html5 meta-tags

12
推荐指数
2
解决办法
4万
查看次数

JavaScript嵌套对象

我有一个关于JavaScript的问题.我目前正在使用类似于以下代码的代码:

function Game() {

}
Run Code Online (Sandbox Code Playgroud)

我想嵌套对象,所以我可以像这样访问它们:

var a = new Game();
a.nested_object.method();
a.nested_object.property;
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?我会使用函数还是{}?或者甚至重要吗?下面的代码是我所指的示例代码.

function Game() {

this.id;

var stats = {};

}
Run Code Online (Sandbox Code Playgroud)

就像我上面所说的那样,我可以像这样访问统计数据:

var a = new Game();
a.stats
Run Code Online (Sandbox Code Playgroud)

javascript oop prototype

4
推荐指数
1
解决办法
3614
查看次数

Javascript检查函数参数

如何检查函数是否未收到参数?例如,我希望能够创建一个接受多个输入的自定义函数,如下所示:

clear();      // clear all
clear('a');   // clear a
clear('b');   // clear b
clear('c');   // clear c
clear('d');   // clear d
Run Code Online (Sandbox Code Playgroud)

javascript oop function

4
推荐指数
1
解决办法
766
查看次数

列表项之间的不需要的边距或填充

我的css中有一个小设计问题,我想知道是否有人可以为我查看.设计问题在于水平导航的翻转效果.似乎有某种额外的边距或填充,但我在css中找不到问题.我将粘贴我正在使用的代码,以便您自己查看.在翻转导航列表项之前,您将无法看到问题.

HTML:

    <div class="Horiznav">
  <ul>
    <li id="active"><a href="#">Link #1</a></li>
    <li><a href="#">Link #2</a></li>
    <li><a href="#">Link #3</a></li>
    <li><a href="#">Link #4</a></li>
    <li><a href="#">Link #5</a></li>
  </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.Horiznav {
  background: #1F00CA;
  border-top: solid 1px #fff;
  border-bottom: solid 1px #fff;
}
.Horiznav ul {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  color: #fff;
  text-Align: center;
  margin: 0;
  padding-top: 5px; padding-bottom: 5px;
}
.Horiznav ul li {
  display: inline;
}
.Horiznav ul li a {
  padding-top: 5px;
  padding-bottom: 5px;
  color: #fff;
  text-decoration: none;
  border-right: 1px solid …
Run Code Online (Sandbox Code Playgroud)

html css html5 css3

2
推荐指数
1
解决办法
3770
查看次数

为什么字符编码对URL很重要?

我目前正在学习JavaScript,我不明白为什么编码URL很重要.

>>> var url = 'http://www.packtpub.com/scr ipt.php?q=this and that';
>>> encodeURI(url);
Run Code Online (Sandbox Code Playgroud)

"http://www.packtpub.com/scr%20ipt.php?q=this%20and%20that"

例如,在此示例中,将第一个URL更改为后一个URL的目的是什么.

html javascript url console

1
推荐指数
2
解决办法
735
查看次数