明确地说,我不想删除内联块元素之间的空间 - 我想添加它。
我想要的是有一个菜单项网格,一行可以有 2、3 或 4 个项目,我想使用媒体查询来实现。
如何在我的 li 项目之间添加空间,但每行的左侧和右侧也没有边距?(填充不会解决这个问题。)我可以只使用 CSS 来实现吗?
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: solid 1px;
font-size: 0;
}
#main {
max-width: 450px;
margin: 0 auto;
}
.item {
display: inline-block;
width: 200px;
}
.item img {
width: 200px;
}
.clearfix {
overflow: auto;
}
li {
list-style-type: none;
}Run Code Online (Sandbox Code Playgroud)
<div id="main">
<li class="item clearfix">
<a href="project.html">
<div class="thumb">
<img src="http://static01.nyt.com/images/2015/06/23/business/greece-portraits-restauranteur/greece-portraits-restauranteur-mediumThreeByTwo225.jpg" alt="Portraits From Greece …Run Code Online (Sandbox Code Playgroud)在我的数据中,我有与国家相关的价值观.我为每个国家创建了缩放的圆圈,现在想使用cx和cy将它们放在每个国家的中心.
我使用具有国家/地区代码'ids'的topoJSON生成了一个地图,并且我的数据(cd)中有匹配的国家/地区代码.
{"type": "Polygon",
"id": 604,
"arcs": [
[133, -473, -448, -378, -374, -413]
]
},
Run Code Online (Sandbox Code Playgroud)
使用D3的path.centroid(feature),如何找到每个topoJSON路径的质心?
g.selectAll("circle")
.data(cd)
.enter()
.append("circle")
.attr("class", "bubble")
.attr("cx", 50)
.attr("cy", 50)
.attr("r", function(d) {
return r(+d.Value)
})
g.selectAll("path")
.data(topojson.object(topology, topology.objects.countries)
.geometries)
.enter()
.append("path")
.attr("d", path)
Run Code Online (Sandbox Code Playgroud)
这里有完整的代码Plunker
我希望在使用ggplot2 facet_wrap时帮助您理解以下错误
Error: `rows` must be `NULL` or a `vars()` list if `cols` is a `vars()` list
Run Code Online (Sandbox Code Playgroud)
我在新计算机上使用全新安装。现在我尝试绘制的任何数据框上都出现错误。例如
test.csv
party,status,emissions
Australia,low,20
Australia,mid,30
Australia,high,40
Finland,low,60
Finland,mid,10
Australia,high,45
Run Code Online (Sandbox Code Playgroud)
[R
library(ggplot2)
library(dplyr)
test <- read.csv("test.csv")
test %>% ggplot() + geom_path(aes(status,emissions)) %>%
facet_grid(vars(party))
#or facet_wrap(~party)
Run Code Online (Sandbox Code Playgroud) 这是我的HTML:
<div class="bar no" style="width: 25.0916%;"></div>
Run Code Online (Sandbox Code Playgroud)
我想将宽度大小作为数字或百分比来访问.
我尝试了以下一些但第一个没有返回任何内容,第二个返回数字,以像素为单位.
width = this.getBBox().width
width = d3.select(this).style("width")
Run Code Online (Sandbox Code Playgroud)
我可以用什么来返回500或25.0%?