我有以下HTML代码:
<select name="forma">
<option value="Home">Home</option>
<option value="Contact">Contact</option>
<option value="Sitemap">Sitemap</option>
</select>
Run Code Online (Sandbox Code Playgroud)
如何将Home,Contact和Sitemap值设为链接?我使用以下代码,因为我预计它不起作用:
<select name="forma">
<option value="Home"><a href="home.php">Home</a></option>
<option value="Contact"><a href="contact.php">Contact</a></option>
<option value="Sitemap"><a href="sitemap.php">Sitemap</a></option>
</select>
Run Code Online (Sandbox Code Playgroud) 从下面的Snippet(View as Fiddle)中可以看到,绝对定位的柱状flexbox不会扩展以适应其子节点.
例如,在Chrome中,它只会与最宽的子元素一样宽,并且与最短的列一样高.
任何人都可以提出解决方案而不使用任何额外的标记?
编辑:列表中的项目数将是动态的,每个项目中的文本也是动态的.我需要在一定数量的项目之后拆分到新列.
*{box-sizing:border-box;}
ul{
background:#090;
display:flex;
flex-flow:column wrap;
left:0;
list-style:none;
max-height:202px;
padding:5px;
position:absolute;
top:0;
}
li{
background:rgba(255,0,0,.75);
color:#fff;
flex:1 0 30px;
font-family:arial;
line-height:30px;
max-height:30px;
margin:1px;
padding:0 2px;
min-width:100px;
}Run Code Online (Sandbox Code Playgroud)
<ul>
<li>Line 0</li>
<li>Line 1</li>
<li>Line 2</li>
<li>Line 3</li>
<li>Line 4</li>
<li>Line 5</li>
<li>Line 6</li>
<li>Line 7</li>
<li>Line 8 is a little bit longer</li>
</ul>Run Code Online (Sandbox Code Playgroud)
我希望能够在响应式设计中添加三个点并在一行中保持文本.
例如:
我有一个带有容器元素内链接的链接(例如<span>).如果文本很长,它将以两行显示一个小屏幕:
This is a very long text
and it wraps because it's very long
Run Code Online (Sandbox Code Playgroud)
我希望该文本显示如下:
This is a very long text...
Run Code Online (Sandbox Code Playgroud)
text-overflow: ellipsis; 如果您已为容器设置宽度,但在响应式设计和我的Web应用程序中,它没有明确指定.
这是HTML:
<div class="itm-title">
<a href="/friendly-url-sample/">This is a very long sentence and I don't want it to wrap, I want three dots</a>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS或jQuery中是否有解决方案可以解决这个问题?谢谢.
我有一个最大宽度的布局,当屏幕宽度大于最大值时,它会水平居中.布局包括固定的标题和菜单; 当屏幕宽度小于最大值时,菜单的left位置为0,当屏幕宽度超过最大值时,菜单的left位置需要与布局其余部分的左边缘齐平.
这是它应该看起来的样子:
*{box-sizing:border-box;margin:0;padding:0;}
header{
align-items:center;
background:#eee;
border-bottom:1px solid #999;
display:flex;
height:100px;
left:0;
justify-content:center;
padding:0 10px;
position:fixed;
right:0;
top:0;
}
h1{
height:60px;
position:relative;
width:calc(100% - 40px);
max-width:740px;
z-index:2;
}
img{
height:100%;
width:auto;
}
nav{
background:#eee;
border-right:1px solid #999;
bottom:0;
left:0;
position:fixed;
top:0;
width:300px;
z-index:1;
}
@media (min-width:801px){
nav{
border-left:1px solid #999;
left:calc((100% - 800px) / 2)
}
}
nav::before{background:#ecc;bottom:0;content:"";left:0;position:absolute;top:0;width:10px;}
nav::after{background:#999;content:"";height:1px;left:0;position:absolute;right:0;top:99px;}
main{background:#ddf;border-left:1px solid #99c;border-right:1px solid #99c;height:100vh;min-height:100%;margin:0 auto;width:100%;max-width:800px;}Run Code Online (Sandbox Code Playgroud)
<header>
<h1><img src="http://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png?v=9c558ec15d8a"></h1>
<nav></nav>
</header>
<main></main>Run Code Online (Sandbox Code Playgroud)
但是,当引入垂直滚动条时,由于滚动条宽度包含在媒体查询中检查的宽度中,导致问题出现,left …
有一个"if"语句接受字符串的快速方法,无论它是小写,大写还是两者都在python中?
我正在尝试编写一段代码,其中可输入数字"3"以及"三"或"三"或任何其他资本和小写的混合,它仍将被"如果"代码中的陈述.我知道我可以使用"或"来接受"3"以及任何其他字符串但是不知道如何让它在多个案例中接受字符串.到目前为止,我有:
if (Class == "3" or Class=="three"):
f=open("class3.txt", "a+")
Run Code Online (Sandbox Code Playgroud) 我正在创建一个node.js利用风帆框架的应用程序。我想创建 PDF 格式的报告。该报告需要包含一个使用chart.js. 数据从 mongodb 获取并显示在canvas. 如何使用 node.js 创建此图表的 PDF 文件?
我想知道这是否只能使用CSS:
Black White
White Black
Black White
White Black
Run Code Online (Sandbox Code Playgroud)
名称代表我想要的颜色背景.在这个jsfiddle中,我已经硬编码以准确显示我想要的是什么,但div的数量将是动态的,所以我不知道会有多少.
我该如何实现这一目标?
我已经为我的广告制作了一些工具提示,这些工具提供了大量的行话 - 他们用简单的鼠标显示.显然它们不适用于触摸界面.
我只限于理想的纯HTML5和CSS3,绝对没有jquery,理想情况下没有javascript.我尝试过更改(或者更确切地说):激活到:悬停类,但触摸屏上什么也没发生.
当前的HTML和CSS是
.tiptext {
cursor: help;
color: black;
font-family: 'ProximaNova', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-weight: 600 !important;
border-bottom: 1px solid #ebebeb;
box-shadow: inset 0 -5px 0 #ebebeb;
-webkit-transition: background .15s cubic-bezier(.33, .66, .66, 1);
transition: background .15s cubic-bezier(.33, .66, .66, 1);
text-decoration: none;
font-size: 14px;
line-height: 172%;
-webkit-animation-name: link-helpoff;
-webkit-animation-duration: 1s;
animation-name: link-helpoff;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
transition-delay: 0.4s;
}
.tiptext::after {
content: "";
position: fixed;
top: 0;
left: 0;
right: 0; …Run Code Online (Sandbox Code Playgroud)由于我是网络编程的新手,我还没有在 css 方面获得太多经验。目前我正在构建一个带有可调整大小的标头的 Web 应用程序。因此我想知道是否可以设置子 div 的宽度相对于其父 div 的高度。
我知道如何处理 javascript 代码中的问题,但我更喜欢纯 css 解决方案。
css 代码如下所示:
.parent {
position: relative;
height: 200px;
width: 600px;
}
.parent .resized {
height: 100px;
}
.child {
position: absolute;
height: 20%;
width: 10% [of parent height];
}
Run Code Online (Sandbox Code Playgroud)
HTML 代码如下所示:
<div class="parent">
<div class="child"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
目前孩子的宽度保持不变,因为父母的宽度保持不变。当父高度调整大小时,我希望孩子的宽度变小。
提前致谢。
我想在单击时将心形变为黑色,但更改 .heart 的颜色不会影响它的 :before :after 选择器。有什么办法吗?
.heart {
background-color: red;
height: 60px; /*dimension of the square*/
position: relative;
top: 40px; /*position from top*/
transform: rotate(-45deg); /*negative = counter clockwise, put 0 to try*/
width: 60px; /*dimension of the square*/
transition: all 1s ease; /*length of animation*/
}
.heart:before,
.heart:after {
content:""; /*kosong, for it to exist*/
background-color: red;
border-radius: 50%; /*perfect round curve*/
height: 60px; /*dimension of the shape*/
position: absolute;
width: 60px; /*dimension of the shape*/
}
.heart:before { …Run Code Online (Sandbox Code Playgroud)