相关疑难解决方法(0)

div内的图像在图像下方有额外的空间

为什么在下面的代码中高度div大于img?图像下方有一个间隙,但它似乎不是填充/边距.

图像下方的间隙或额外空间是多少?

#wrapper {
  border: 1px solid red;
  width:200px;
}
img {
  width:200px;
}
Run Code Online (Sandbox Code Playgroud)
<div id="wrapper">
  <img src="http://i.imgur.com/RECDV24.jpg" />
</div>
Run Code Online (Sandbox Code Playgroud)

图像下面有间隙或空白区域

html css image

470
推荐指数
7
解决办法
14万
查看次数

MapBox标记继续缩放

我正在使用MapBoxgl,我想添加几个标记.

这是我的index.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
        <link href=" /assets/css/bootstrap.min.css " rel="stylesheet" />
        <link href=" /assets/css/mapbox-gl.css " rel="stylesheet" />
        <link href=" /assets/css/main.css " rel="stylesheet" />
</head>
<body>
        <div id="map"></div>

<script src="/assets/js/mapbox-gl.js"></script>
<script src="/assets/js/map-style.js"></script>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是map-style.js:

var map = new mapboxgl.Map({
  container: 'map',
  center: [57.3221, 33.5928],
  zoom: 5,
  style: style
});


var geojson = {
type: 'FeatureCollection',
features: [{
type: 'Feature',
geometry: {
  type: 'Point',
coordinates: [30.61, 46.28]
},
properties: {
  title: 'point 1',
  description: 'point 1 Description', …
Run Code Online (Sandbox Code Playgroud)

marker mapbox mapbox-gl-js

7
推荐指数
2
解决办法
1279
查看次数

当 DIV 的高度设置为“100%”时,为什么计算出的 DIV 高度大于其内容(如 svg)?

这是我的代码:

<!DOCTYPE html>
<html>

<body>
  <div align="center" style="width:100%; height:100%; padding: 0px; margin: 0px;">
    <svg height="500" version="1.1" width="1000" xmlns="http://www.w3.org/2000/svg" id="raphael-paper-0" style="overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: none; cursor: default; position: relative; background-color: rgb(255, 255, 255);">
      <circle cx="500" cy="250" r="100" stroke="green" stroke-width="4" fill="yellow" />
    </svg>
  </div>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

我得到的 SVG 计算尺寸为 1000 X 500,但 DIV 的计算尺寸为 1264 X 504。

DIV 的宽度 - 1264px 是页面的宽度,因为它以 100% 的形式提供,即可以理解,但为什么高度是 504px,而 SVG 高度是 500px?

提前致谢。

html css svg

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

标签 统计

css ×2

html ×2

image ×1

mapbox ×1

mapbox-gl-js ×1

marker ×1

svg ×1