简体   繁体   English

Div占用了额外的空间

[英]Div is taking a extra space

Hi I have a div inside it there is a svg.i tried ti figur out using firebug but havent sound any solution of why div is taking the extra space rather than the height of the svg. 嗨,我里面有一个div,里面有一个svg.i我用Firebug试了一下,但还没有任何声音解决div为什么要占用额外空间而不是svg高度的问题。

Please have look on to the screen shots. 请看一下屏幕截图。

firefox: 火狐:

div height width div高度宽度 在此处输入图片说明

svg height width svg高度宽度

在此处输入图片说明

Now have a look at the chrome screen shots 现在看一下chrome屏幕截图

div DIV 在此处输入图片说明

svg SVG 在此处输入图片说明

i am a little bit new so i am not understanding how to solve this 我有点新,所以我不明白如何解决这个问题

insert the css into map id 将CSS插入地图ID

if you able to modify map div simply use inline style 如果您能够修改map div,则只需使用内联样式

element.style {
   clear: both;
   display: block;
   height: 615px !important;
   overflow: hidden;
}

else create internal css 否则创建内部CSS

#map{
clear: both !important;
   display: block !important;
   height: 615px !important;
   overflow: hidden !important;
}

you just add the doc type. 您只需添加文档类型。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

For my knoladge, the SVG iks still a "hack" with browsers. 对我而言,SVG ik仍然是浏览器的“黑客”。 It tends to ignore your width and height parametres. 它往往会忽略您的宽度和高度参数。 We have similar issues on our page (mybbeye.com). 我们的页面(mybbeye.com)也有类似的问题。 We were unable to resolve it, so I would recomend just to transform your SVG graphics in a png image. 我们无法解决它,因此我建议您仅将SVG图形转换为png图像。 With that, at least you can have a total control of width and heigth. 这样,至少您可以完全控制宽度和高度。

Also if your SVG is from apple KeyNote, note that this software is bad : it adds font and size class for every letter 另外,如果您的SVG来自苹果公司的KeyNote,请注意,该软件很糟糕:它会为每个字母添加字体和大小类

Was meant as comment :) 被指作为评论:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM