#first {
text-align: center;
font-size: 40px;
font-weight: 200;
}
#second {
text-align: center;
font-size: 25px;
font-weight: 50;
}
#third {
text-align: center;
}Run Code Online (Sandbox Code Playgroud)
<p id="first">One account.All of google</p>
<p id="second">Sign in to continue to Gmail</p>
<div id="login">
<form>
<img src="img.jpg">
<input type="text" name="username" value="Enter your username">
<br>
<input type="password" name="password" value="password">
<br>
<input type="submit" value="Sign in">
<br>
<a href="">Forgot password?</a>
</form>
</div>
<p id="third">Sign in with different account</p>Run Code Online (Sandbox Code Playgroud)
我无法减少font-weight。我希望#secondid 的权重小于#firstid 的权重。我已经使用了,font-weight但仍然不起作用。
如果两个变量具有相同的内容,为什么我会收到错误?
function A() { return {k:'k'}; }
function B() { return {k:'k'}; }
var a = new A;
var b = new B;
var s='';
for (prop in a) {
if (typeof a[prop] != "function") {
s += "a[" + prop + "] = " + a[prop] + "; ";
}
}
alert(s);
for (prop in b) {
if (typeof b[prop] != "function") {
s += "b[" + prop + "] = " + b[prop] + "; ";
}
} …Run Code Online (Sandbox Code Playgroud) 我在全屏显示的另一个div中垂直和水平居中放置div时遇到问题。子div的宽度和高度是固定的。
这是代码:
html, body {
height: 100%;
margin: 0;
}
#header {
overflow: hidden;
width:100%;
height: 100%;
background: orange;
background-size:cover;
-webkit-background-size:cover;
display: table;
}
#wrap {
height: 200px;
width: 500px;
background:white;
margin:0px auto;
}Run Code Online (Sandbox Code Playgroud)
<div id="header">
<div id="wrap">
<h1>Header</h1>
<div id="some-text">Some text some text some text some text</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
我正在构建一个适用于Windows Phone 8.1的应用程序,我的滚动查看器会在您发布滚动后继续回到顶部.它就像我拖下来一样,当我释放它时,它会快速回到顶部.
<ScrollViewer Margin="10,0,10,-1024" Height="1124" VerticalAlignment="Top"
VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled"
AllowDrop="False" BringIntoViewOnFocusChange="True"
HorizontalScrollMode="Disabled" IsHoldingEnabled="True" >
<Grid Grid.Row="1" x:Name="ContentRoot" Height="468" Width="386" >
<TextBlock HorizontalAlignment="Left" Margin="64,326,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Foreground="White"
FontSize="16" Width="307" Height="68" >
<Run Foreground="#FFFF6767" Text="Single Phase "/>
<Run Foreground="#FFFF6767" Text="Amperes "/>
<Run Text="= "/>
<Run Text="(746 x Horsepower) / (Volts x Efficiency x Power Factor"/>
<Run Text=")"/>
</TextBlock>
</Grid>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud) 所以这是我在JavaScript中非常简单的代码:
var chessBoard = function (size) {
for (var i = 0; i<size; i++) {
var line = "";
if (i%2 == 0)
line =+ " ";
for (var j = 0; j<size; j++) {
if (j%2 == 0)
line += " ";
else
line += "#";
}
console.log(line);
}
}
chessBoard(8);
Run Code Online (Sandbox Code Playgroud)
这是输出:
0 # # # #
# # # #
0 # # # #
# # # #
0 # # # #
# # # # …Run Code Online (Sandbox Code Playgroud) 我这里有个小提琴.
@import 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css';
hotel-btn-container {
display: table;
width: 100%;
}
hotel-btn {
display: table-cell;
text-align: center;
}Run Code Online (Sandbox Code Playgroud)
<div style="display: table; width: 100%;">
<p style="display: table-cell; text-align: center;">
<a class="btn btn-primary" href="tel:2125550101">Call Us</a>
</p>
<p style="display: table-cell; text-align: center;">
<a class="btn btn-primary" href="#" target="_blank">Website</a>
</p>
</div>
<br><br>
<div class="hotel-btn-container">
<p class="hotel-btn">
<a class="btn btn-primary hotel-btn" href="#">Call Us</a>
</p>
<p class="hotel-btn">
<a class="btn btn-primary hotel-btn" href="#">Website</a>
</p>
</div>Run Code Online (Sandbox Code Playgroud)
我有两个与内联CSS并排的按钮.按钮显示正常.
<div style="display: table; width: 100%;">
<p style="display: table-cell; text-align: center;">
<a …Run Code Online (Sandbox Code Playgroud) 以下代码无法正常工作(jsFiddle):
function makeFoo(a, b) {
var foo = new Foo();
Foo.apply(foo, arguments);
return foo;
}
var Foo = function(a, b) {
console.log(
"This should be called once. "+
"a=\"" + a + "\", " +
"b=\"" + b + "\", "
);
this.a = a;
this.b = b;
}
Foo.prototype.go = function() {
console.log("a: " + this.a);
console.log("b: " + this.b);
};
var foo = makeFoo("Hello", "World");
foo.go();Run Code Online (Sandbox Code Playgroud)
预期产量:
这应该被调用一次.a ="你好",b ="世界"
a:你好
b:世界
实际产量:
这应该被调用一次.a ="undefined",b ="undefined" …
这是一系列关于CSS中语法的问题.这也是社区Wiki,因此邀请每个人参与维护此列表.
Stack Overflow不允许搜索特定字符.因此,在搜索运算符和其他语法标记时,很难找到许多关于运算符和其他语法标记的问题.这也使得关闭重复更加困难.以下列表是为了解决此问题.
主要思想是在Stack Overflow上链接现有问题,因此我们更容易引用它们,而不是复制各种CSS规范中的内容.
此外,这是JavaScript符号引用的公然副本.我们需要一个CSS.
请帮忙.编辑并添加指向其他运算符/语法参考的链接,或者如果您无法在特定语法上找到好的问题/答案,请添加此问题的答案并将其链接
我有一些HTML,我试图用这个脚本获得"data-nChargers"的价值
var noOfChargers = document.getElementById("chargers-list")
.getAttribute("nChargers");
console.log(noOfChargers);Run Code Online (Sandbox Code Playgroud)
<div id="chargers-list" data-nChargers="4"></div>Run Code Online (Sandbox Code Playgroud)
但它返回null.我究竟做错了什么?
我有这个代码示例:
function s () {
this.func = [];
this.func.addF = function (str) {
this.func.push(str);
}
}
Run Code Online (Sandbox Code Playgroud)
当我创建该对象的实例时:
var a = new s ();
a.func.addF ("hello");
Run Code Online (Sandbox Code Playgroud)
我得到一个错误说:未捕获的TypeError:无法读取未定义的属性'push'.
我可以理解那时this.func尚未定义,但我该怎么做才能使这项工作成功.请帮忙.
javascript ×5
css ×3
html ×3
arrays ×1
c# ×1
center ×1
console.log ×1
css3 ×1
dom ×1
scrollviewer ×1
xaml ×1