简体   繁体   English

CSS和html中的位置问题

[英]Problem with position in CSS and html

I'm having a problem with a CSS. 我的CSS有问题。 I have a little image with the problem: 我对这个问题有些了解:

The first part show what happend when in the block "Contenido" it's empty, and the second part when it has something. 第一部分显示在“ Contenido”块中为空时发生的情况,第二部分显示有内容时。 The problem? 问题? The second botton use a break and appear under of the other bootom. 第二个botton使用中断,并出现在另一个赃物的下面。 I have tried a pair of styls, but i can't get with one that work. 我已经尝试过一对手写笔,但是我无法做到这一点。 What i have in CSS and html? 我在CSS和html中拥有什么?

<div class="nav-pad">
    <button id="previous_left" class="button_previous">
        <img src="/images/left-arrow.png"/>
    </button>
    <div id=info_left>
         Here we could put some info but it give a problem
    </div>
    <button id="next_left" class="button_next">
        <img  src="/images/right-arrow.png"/>
    </button>
</div>

And in the CSS i have this one: 在CSS中,我有一个:

.nav-pad{
  padding: 0.2em;
  postion: relative;
}
.button_next{
  float:right;
  right:0
}
.button_previous{
  left:0;
}

Any clue what i'm doing bad? 任何线索我在做什么不好? Thanks a lot! 非常感谢! Roberto 罗伯托

I edited your HTML and CSS a little bit but I made it work, I am still not sure what you are trying to get here. 我对您的HTML和CSS进行了一些编辑,但是使它起作用了,但是我仍然不确定您要达到的目的。

The code may need to change in order to get better results 为了获得更好的结果,可能需要更改代码

click on the link bellow to see an example of the answer 单击下面的链接以查看答案的示例

Did u gave any width for the nav-pad div, if yes then remove it. 您是否为nav-pad div设置了任何宽度,如果是,则将其删除。

Else try adding overflow:auto to the nav-pad class.. 否则,请尝试将nav-pad类添加overflow:auto

Can you please give us a sample page with this style and content, so that we can figure out the exact error.. 您能给我们一个带有这种样式和内容的示例页面,以便我们找出确切的错误。

.nav-pad {}
.button-next { display:inline-block }
.button-previous { display:inline-block }
#info-left { display:inline-block }

To accomplish the same layout, What I will do is: 为了完成相同的布局,我将要做的是:

.nav-pad{
  padding: 0.2em;
  clear:both;
  overflow: hidden;
}
.button_next{
  float:right;
}
.button_previous{
  float: left;
}
#info_left{
    float: left;
}

Well i have solved. 好吧,我解决了。 The help that you give me, give me a clues to solve it: With this html: 您给我的帮助,为我提供了解决的线索:使用此html:

<div class="nav-pad">    
<button id="previous_left" class="button_previous">
    <img src="http://www.baltimark.com/_/rsrc/1234983635623/public/tech/stackoverflow-logo-250.png"/>
</button>       
<div id="info_left">
     Here we cdfgdfould put some info but it give a problem
</div>        
<button id="next_left" class="button_next">
    <img  src="http://www.baltimark.com/_/rsrc/1234983635623/public/tech/stackoverflow-logo-250.png"/>
</button>
</div>

and this css: 和这个CSS:

.nav-pad{
  padding: 0.2em;
  border: solid 1px green;
  overflow: auto;
}

.button_previous{
  float: left;
  width : 15%;
}

.button_next{
  float:right;
  width : 15%;
}
#info_left {
  float: left;   
  width : 70%;
}

Thanks a lot! 非常感谢!

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

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