我正在尝试使此列表的列表元素全宽。他们有填充,当你悬停在它们上面时,填充是黄色的。
填充没有填满整个 ul 块,这正是我想要它做的。
我曾尝试使用不同的显示器并使列表元素的宽度为 100%,但这不起作用。
.footer-navigation {
list-style: none;
padding-left: 0px;
display: inline-block;
width: 100%;
}
.footer-navigation li {
padding: 10px;
width: 100%;
}
.footer-navigation a {
padding: 10px;
color: #000000;
}
.footer-navigation a:hover {
padding: 10px;
color: #ffffff;
background-color: #fac900;
}
Run Code Online (Sandbox Code Playgroud)
<ul class="footer-navigation">
<li><a href="#">Terms & Conditions</a>
</li>
<li><a href="#">Cookie Policy</a>
</li>
<li><a href="#">Sitemap</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我有一些文字我希望环绕图像 - 我知道我需要将图像浮动到左边以强制文本环绕它.无论我做什么似乎都没有用?
我在这里设置了一个codepen:https://codepen.io/emilychews/pen/GmdZOb
代码如下以供快速参考.
* {
padding: 0;
margin: 0;
}
.outer {
width: 50%;
height: 50vh;
background: blue;
}
.inner {
display: block;
width: 25%;
height: 25vh;
background: red;
float: left;
margin-right: 10px;
}
p {
color: white;
}
Run Code Online (Sandbox Code Playgroud)
<div class="outer">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo …
Run Code Online (Sandbox Code Playgroud)color
父块的属性有一个!important
声明。为什么孩子的财产优先?怎么解释?
我看到了特殊性的解释,但我不明白如何将它们应用于这个特殊情况。
也许我错过了文档中的一些基本位置......
div {
color: purple !important;
font-family: 'Open Sans', serif;
font-size: 30px;
font-weight: bold;
}
span {
color: red; /* Why does parent's `!important` lose? */
}
Run Code Online (Sandbox Code Playgroud)
<div>
Parent
<span>Child</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我有一个使用引导程序创建的布局,并且有一个“阅读更多”按钮可以扩展文本。文本展开后,将变为“显示较少”。我的问题是,当用户单击“显示较少”按钮时,按钮文本首先变回“阅读更多”,然后仅折叠THEN文本(段落)。这个时差很明显。但是,是否有一种方法可以使按钮在折叠后更改其文本,或者以某种方式使此时差不那么明显?
在我的js文件中,只有用于更改按钮文本的代码,并且文本切换完全在引导程序上进行,也许我不应该对这个特定按钮使用引导程序?
请注意,我的问题不在于将按钮文本本身从“阅读更多”更改为“显示更少”,我知道周围有很多解决方案。
标记“更多”按钮:
<p>Initital text <span id="moreText" class="collapse">more text here...</span><a id="readMore" data-toggle="collapse" href="#moreText">Read More</a>
Run Code Online (Sandbox Code Playgroud)
按钮的JS:
$(function() {
$('#readMore').click(function() {
$(this).text(function(i,def) {
return def=='Read More' ? 'Show Less' : 'Read More';
});
})
});
Run Code Online (Sandbox Code Playgroud) 我希望能够为颜色名称设置颜色,因此如果用户输入字符串"green",颜色将是特殊的绿色,如#34ff8b.
我已经尝试使用变量并将颜色设置为字符串'green',但这不是有效的js.
期望的结果: 用户输入颜色名称"绿色",javascript使用js代码中的特殊颜色集.
const myButton = document.getElementById('myButton');
const myHeading = document.getElementById('myHeading');
const myTextInput = document.getElementById('myTextInput');
myButton.addEventListener('click', () => {
myHeading.style.color = myTextInput.value;
} );
Run Code Online (Sandbox Code Playgroud)
@import 'https://fonts.googleapis.com/css?family=Lato:400,700';
body {
color: #484848;
font-family: 'Lato', sans-serif;
padding: .45em 2.65em 3em;
line-height: 1.5;
}
h1 {
margin-bottom: 0;
}
h1 + p {
font-size: 1.08em;
color: #637a91;
margin-top: .5em;
margin-bottom: 2.65em;
padding-bottom: 1.325em;
border-bottom: 1px dotted;
}
ul {
padding-left: 0;
list-style: none;
}
li {
padding: .45em .5em;
margin-bottom: .35em;
display: flex; …
Run Code Online (Sandbox Code Playgroud)什么是默认display:
属性:AFTER和:指定后的伪元素之前content
.
难道display: inline
还是display: inline-block
?
无法在默认的css值列表中找到它
例:
div {
border: solid 1px black;
padding: 5px;
}
div:before {
content: "Before: Am I inline-block or inline?";
color:red;
}
div:after {
content: "After: Am I Inline-block or inline?";
color:green;
}
Run Code Online (Sandbox Code Playgroud)
<div>Div 1</div>
<div>Div 2</div>
<div>Div 3</div>
<div>Div 4</div>
Run Code Online (Sandbox Code Playgroud)
我一直在使用HTML和CSS的网站.
@font-face {
font-family: NS;
src: url(https://cdn.getforge.com/rappatic.getforge.io/1513714024/fonts/nsr.ttf);
}
@font-face {
font-family: PS;
src: url(https://cdn.getforge.com/rappatic.getforge.io/1513714024/fonts/psr.ttf);
}
@font-face {
font-family: KR;
src: url(https://cdn.getforge.com/rappatic.getforge.io/1513714024/fonts/kr.ttf);
}
@font-face {
font-family: ANR;
src: url(https://cdn.getforge.com/rappatic.getforge.io/1513714024/fonts/anr.otf)
}
body {
/*background: linear-gradient(to top right, #FFE259, #FFA751, #FFAF7B);
background-attachment: fixed;*/
width: 100%;
margin: auto;
height: 100%;
}
p {
font-family: "ns";
}
h1 {
font-family: "anr";
}
.white {
color: #ffffff;
}
.black {
color: #000000;
}
Run Code Online (Sandbox Code Playgroud)
<div style="width: 100%; background: linear-gradient(to top right, #FFE259, #FFA751, #FFAF7B); background-attachment: fixed;">
<div …
Run Code Online (Sandbox Code Playgroud)正如标题所说,我在使用jquery将图像转换为链接时遇到了一些问题.我的代码现在是:
var all_img = $(".message .content").find("img");
$.each(all_img, function (index, value) {
var src = value.src;
value.replaceWith($("<a href='" + src +"'>Image " + index+1 + "</a>"));
});
Run Code Online (Sandbox Code Playgroud)
这导致图像被替换[object Object]
.我也尝试过:
$.each(all_img, function (index, value) {
var src = value.src;
value.replaceWith("<a href='" + src +"'>Image " + index+1 + "</a>");
});
Run Code Online (Sandbox Code Playgroud)
这导致我试图插入的html作为普通的不可点击的文本.我误解了怎么.replaceWith()
运作?
我找不到以下代码无效的原因:
var nav = document.getElementById("nav").style.visibility;
if (nav === "" || nav === "hidden")
nav = "visible";
else
nav = "hidden";
Run Code Online (Sandbox Code Playgroud)
有人可以解释我为什么我不能改变nav
if..else?
$('#cypher-branding-letter-spacing').change(function(e) {
$('#cypher-branding-main-edit-right-txt-text').css('letter-spacing', $('#cypher-branding-letter-spacing').val() + 'px');
});
//add text to design
$(document).on('click', '#cypher-branding-btn-add-to-design-text', function() {
//remove the canvas border before creating the image, then add it back
$("#cypher-branding-main-edit-right-txt-text-wrapper").css('border', 'none');
html2canvas($("#cypher-branding-main-edit-right-txt-text-wrapper"), {
onrendered: function(canvas) {
var id = guid();
var img = new Image();
img = $('#cypher-branding-text-temp-img').find('img')[0];
img.src = canvas.toDataURL('image/png');
var w = canvas.width;
var h = canvas.height;
//var elem = $('<div id="cypher_container_' + id + '" class="cypher-container"><div id="cypher_container_inner_' + id + '" class="tooltip"><img id="cypher_container_img' + id + '" onclick=showLogoCommands("' + …
Run Code Online (Sandbox Code Playgroud)