简体   繁体   English

CSS填充无法正常工作

[英]Css padding not working properly

I'm working in the main page of www.recaccesorios.com and I'm struggling with a padding. 我正在www.recaccesorios.com的主页上工作,并且正在努力填充。 The vertical distance between two elements is too big and I don't know why is doing that. 两个元素之间的垂直距离太大,我不知道为什么这样做。 I'll show you the inspection with Google Chrome: 我将向您展示使用Google Chrome浏览器进行的检查:

在此处输入图片说明

As you can see, Chrome is telling me that the top padding is 0 or null, but in the image you can see that it isn't true. 如您所见,Chrome告诉我顶部填充为0或为null,但是在图像中您可以看到它不是真实的。 What is happening? 怎么了?

My horrible CSS (not the whole CSS, I can't put here more than 3000 lines...): 我可怕的CSS(不是整个CSS,在这里我不能超过3000行...):

#galeria {

-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: rgb(222,222,222);
background-color: rgba(222,222,222,0.8);
border: 1px solid #e5e5e5;
border-radius: 4px;
/* padding-bottom: 40px; */
width: 100%;
}

#galeria > h5 {
text-align: center;
}

#noticias > h5 {
text-align: center;
}

#noticias a {
color:#555;
}

#noticias p {
text-align : justify;
padding-left:12px;
padding-right:12px;
}

#noticias {
height:292px;
}

#vistaPrevia {
position: absolute;
z-index: 6;
top: 40px;
display: none;
}

#galeria > img {
display: block;
margin-left: auto;
margin-right: auto;
}

#galeria > span {
margin-left: 5px;
}
#noticias {

-moz-border-radius: 4px; 
-webkit-border-radius: 4px; 
background-color: rgb(222,222,222); 
background-color: rgba(222,222,222,0.8);
border: 1px solid #e5e5e5;
border-radius: 4px;
/* padding-bottom: 40px; */
width: 100%;
}

.td-galeria {
padding-right: 6px;
padding-left: 0px;
border-color:transparent;
width:50%; 
height:300px;
}

.td-noticias {
padding-left: 6px;
padding-right: 0px;
}

I believe the issue is the reset on line 42 of the CSS file vertical-align: baseline; 我认为问题是CSS文件vertical-align: baseline;第42行的重置vertical-align: baseline; this seems to be causing your chrome issues. 这似乎是造成您的Chrome问题的原因。

This solves the issue: 这样可以解决问题:

#tablaInicio td {vertical-align:}

But it is strange. 但这很奇怪。

EDIT: 编辑:

Found out why it is strange; 找出为什么奇怪。 it is a JS script causing the extra height. 它是导致额外高度的JS脚本。

The Problem exists in line 42 of Style.css; 问题存在于Style.css的第42行中;

remove vertical-align:baseline; 删除vertical-align:baseline;

and also correct 而且正确

#tablaInicio td {vertical-align:}

We need to see your CSS to understand this better. 我们需要查看您的CSS才能更好地理解这一点。 But, I'm guessing you've declared the padding somewhere else in your code. 但是,我猜您已经在代码的其他地方声明了填充。

In your CSS file, change the padding value line to something like this:- 在您的CSS文件中,将填充值行更改为以下内容:-

"padding: 0px !important"; “填充:0px!重要”;

the !important message means it will ignore any other values you try to set for padding. !important消息表示它将忽略您尝试为填充设置的任何其他值。

I hope this helps. 我希望这有帮助。

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

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