时间:2016-09-13 23:17:04

标签: javascript html css

我有一个由3列体组成的页面。在第一列和第三列内有按钮。我试着正确定位它们。

特别是,我的第一列按钮有问题,必须显示在页面底部(靠近页脚)。

但我使用的样式没有效果。我想这是因为列是空的并且定位相对于它的高度起作用。我试图使用height:100%;属性,但它不起作用。

我应该如何解决这个问题?

     <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet"                                        href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
 html {
         position: relative;
         min-height: 100%;
      }
 body {
        margin-bottom: 20vh;
        background-color:#f2f2f2;
        }
       footer {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 10vh; 
       }

        footer {
           background-color: black;
           color:white;
          }  </style>
         <style>
              #upButton {position:absolute; left:0px; bottom:0px;}
         </style>

         <style>
              .col1 {height:100%;}
         </style>
</head>
 <body>
             <div id="header" class="header" align="center">
                            <h1 align="center">Some header
                            <small>some subheader</smalll>
               </div>                         
           <div class="container">
                       <div class="row">
                                 <div  class="col-md-2 col1"> 
                                                  <a id="upButton" 
                                      href="#header" class="btn btn-success" 
                                      role="button">Up
                                                   </a>
                                 </div>
                                 <div class="col-md-8">...</div>
                                 <div class="col-md-2">
                                     <a href="#f" align="right" class="btn 
                                 btn-danger" role="button">Down
                                     </a>
                                 </div>
                      </div>
          </div>  
     <footer>
         <div class="container-fluid">
            <p><a id="f">All right unreserved</a></p>
         </div>
      </footer>
</body>

所以现在我的解决方案只有在我在第一列中放入大量文本时才有效 - 然后Up按钮就在它的底部附近。但没有文字它会向上发展..

编辑:我设法通过将两个按钮直接放入正文来解决它,但是如果有一个解决方案允许它们保留在各自的列中,我想知道。upbutton {{3} }   在图片上,向上按钮位于页脚旁边,而向下按钮靠近页眉。

编辑:提出解决方案的代码:

     <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet"                                        href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
 html {
         position: relative;
         min-height: 100%;
      }
 body {
        margin-bottom: 20vh;
        background-color:#f2f2f2;
        }
       footer {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 10vh; 
       }

        footer {
           background-color: black;
           color:white;
          }  </style>


         <style>
                  #upButton {position:fixed; left:0px; bottom:100px;}
                  .col1 {height:100%;}
         </style>


</head>
 <body>
             <div id="header" class="header" align="center">
                            <h1 align="center">Some header
                            <small>some subheader</smalll>
               </div>                         
           <div class="container">
                       <div class="row">
                                 <div  class="col-md-2 col1"> 
                                                  <a id="upButton" 
                                      href="#header" class="btn btn-success" 
                                      role="button">Up
                                                   </a>
                                 </div>
                                 <div class="col-md-8">.This book must have been revolutionary when it came out in the 1930s. The language, the style, the unbashed uncaring for literary norms must have been like a fresh air of rebellion to the stifled people of the 1930s who just few decades ago were under the moral oppression of the Victorian age. The book begins with an ode to Tanya's cunt. And it continues in the same manner. The word cunt is probably the most used word in the entire book. Today it would be called vulgar, but at the time it was revolutionary and brave. Miller describes multiple women he's had sex with while living in Paris, mostly on the money of other people, or as a vagrant and homeless on the streets. Most of the women he sleeps with are prostitutes (and he goes at length discussing the different types of prostitutes), but there is also the Jewish adulteress, the Russian princess with gonorrhea, the strange french woman to whom he gives 100 francs and then takes them out of her purse after having sex with her in her house above the room of her sick mother. Chapters of lucid description of characters (mostly Miller's friends whose money he uses, at whose houses he sleeps and whose women he has sex with) and some semblance of story lines are alternated with chapters of stream-of-consciousness monologues with prophetic statements and deep insights into life and living that usually come only after a very heavy intoxication with various substances. The book finishes in a middle of an action, just like it starts. Nothing really happens throughout and there's no sustained plot or even any novel-long characters (except the author-narrator) but it does give an entertaining and fascinating view into the life of the American emigres to Paris between the two wars in a much different way than Hemingway. POSTED BY MR.B. AT 2:12 PM NO COMMENTS: THURSDAY, JULY 7, 2016 "Mount Analogue" by Rene Daumal It ends in mid-sentence in the fifth chapter. Rene Daumal died days later of tubercolosis. He was in his 36th year of his life. Peradams. Only Father Sogol (Logos, took me a while to figure it out without anyone pointing it out to me) found one and very low, below the mountain where no Peradams are usually found, but he had an epiphany about himself. The book has an extensive intro section where the future planned chapters by Daumal are explained and it is a real shame that they were not written. Or maybe the book is more effective this way? After all Gurdjieff's "Life is real only when I AM" also stops in a middle of a sentence, and some who have seen the original manuscripts say that the published version is a much smaller selection from what was available. "Mount Analogue" is a very readable and well written book, to be expected from a writer of Daumal's caliber, and although Gurdjieff's name is never explicitly mentioned - it is based on the ideas and understanding of Gurdjieff's system (not to be called "The Fourth Way", but simply the "Gurdjieff System") and contains the personal thoughts and development of a person working on themselves according to the system. The explanation on how Mount Analogue This book must have been revolutionary when it came out in the 1930s. The language, the style, the unbashed uncaring for literary norms must have been like a fresh air of rebellion to the stifled people of the 1930s who just few decades ago were under the moral oppression of the Victorian age. The book begins with an ode to Tanya's cunt. And it continues in the same manner. The word cunt is probably the most used word in the entire book. Today it would be called vulgar, but at the time it was revolutionary and brave. Miller describes multiple women he's had sex with while living in Paris, mostly on the money of other people, or as a vagrant and homeless on the streets. Most of the women he sleeps with are prostitutes (and he goes at length discussing the different types of prostitutes), but there is also the Jewish adulteress, the Russian princess with gonorrhea, the strange french woman to whom he gives 100 francs and then takes them out of her purse after having sex with her in her house above the room of her sick mother. Chapters of lucid description of characters (mostly Miller's friends whose money he uses, at whose houses he sleeps and whose women he has sex with) and some semblance of story lines are alternated with chapters of stream-of-consciousness monologues with prophetic statements and deep insights into life and living that usually come only after a very heavy intoxication with various substances. The book finishes in a middle of an action, just like it starts. Nothing really happens throughout and there's no sustained plot or even any novel-long characters (except the author-narrator) but it does give an entertaining and fascinating view into the life of the American emigres to Paris between the two wars in a much different way than Hemingway. POSTED BY MR.B. AT 2:12 PM NO COMMENTS: THURSDAY, JULY 7, 2016 "Mount Analogue" by Rene Daumal It ends in mid-sentence in the fifth chapter. Rene Daumal died days later of tubercolosis. He was in his 36th year of his life. Peradams. Only Father Sogol (Logos, took me a while to figure it out without anyone pointing it out to me) found one and very low, below the mountain where no Peradams are usually found, but he had an epiphany about himself. The book has an extensive intro section where the future planned chapters by Daumal are explained and it is a real shame that they were not written. Or maybe the book is more effective this way? After all Gurdjieff's "Life is real only when I AM" also stops in a middle of a sentence, and some who have seen the original manuscripts say that the published version is a much smaller selection from what was available. "Mount Analogue" is a very readable and well written book, to be expected from a writer of Daumal's caliber, and although Gurdjieff's name is never explicitly mentioned - it is based on the ideas and understanding of Gurdjieff's system (not to be called "The Fourth Way", but simply the "Gurdjieff System") and contains the personal thoughts and development of a person working on themselves according to the system. The explanation on how Mount Analogue would have been physically hidden from anyone for so long is definitely done by the latest science available at that period (1930s), but with today's satellites and space observation does not hold well at all, although it was probably ingenious for the time. Also getting there, getting in and discovering no new technology (based on electricity) works on the mountain is also very interesting, especially connected to Gurdjieff's notion that electricity was discovered before and is not an inexhaustible resource. Of course, Father Sogol is no one but Alexandre de (von) Saltzmann, one of the foremost Gurdjieff's students, of whom not as much is known, compared to the other students like Alexandre's wife Jeanne, and the de (von) Hartmann's. He must have been a formidable personality to have left such an impression on Daumal. This book is a gem, even in its unfinished form, or maybe because of it.This book must have been revolutionary when it came out in the 1930s. The language, the style, the unbashed uncaring for literary norms must have been like a fresh air of rebellion to the stifled people of the 1930s who just few decades ago were under the moral oppression of the Victorian age. The book begins with an ode to Tanya's cunt. And it continues in the same manner. The word cunt is probably the most used word in the entire book. Today it would be called vulgar, but at the time it was revolutionary and brave. Miller describes multiple women he's had sex with while living in Paris, mostly on the money of other people, or as a vagrant and homeless on the streets. Most of the women he sleeps with are prostitutes (and he goes at length discussing the different types of prostitutes), but there is also the Jewish adulteress, the Russian princess with gonorrhea, the strange french woman to whom he gives 100 francs and then takes them out of her purse after having sex with her in her house above the room of her sick mother. Chapters of lucid description of characters (mostly Miller's friends whose money he uses, at whose houses he sleeps and whose women he has sex with) and some semblance of story lines are alternated with chapters of stream-of-consciousness monologues with prophetic statements and deep insights into life and living that usually come only after a very heavy intoxication with various substances. The book finishes in a middle of an action, just like it starts. Nothing really happens throughout and there's no sustained plot or even any novel-long characters (except the author-narrator) but it does give an entertaining and fascinating view into the life of the American emigres to Paris between the two wars in a much different way than Hemingway. POSTED BY MR.B. AT 2:12 PM NO COMMENTS: THURSDAY, JULY 7, 2016 "Mount Analogue" by Rene Daumal It ends in mid-sentence in the fifth chapter. Rene Daumal died days later of tubercolosis. He was in his 36th year of his life. Peradams. Only Father Sogol (Logos, took me a while to figure it out without anyone pointing it out to me) found one and very low, below the mountain where no Peradams are usually found, but he had an epiphany about himself. The book has an extensive intro section where the future planned chapters by Daumal are explained and it is a real shame that they were not written. Or maybe the book is more effective this way? After all Gurdjieff's "Life is real only when I AM" also stops in a middle of a sentence, and some who have seen the original manuscripts say that the published version is a much smaller selection from what was available. "Mount Analogue" is a very readable and well written book, to be expected from a writer of Daumal's caliber, and although Gurdjieff's name is never explicitly mentioned - it is based on the ideas and understanding of Gurdjieff's system (not to be called "The Fourth Way", but simply the "Gurdjieff System") and contains the personal thoughts and development of a person working on themselves according to the system. The explanation on how Mount Analogue would have been physically hidden from anyone for so long is definitely done by the latest science available at that period (1930s), but with today's satellites and space observation does not hold well at all, although it was probably ingenious for the time. Also getting there, getting in and discovering no new technology (based on electricity) works on the mountain is also very interesting, especially connected to Gurdjieff's notion that electricity was discovered before and is not an inexhaustible resource. Of course, Father Sogol is no one but Alexandre de (von) Saltzmann, one of the foremost Gurdjieff's students, of whom not as much is known, compared to the other students like Alexandre's wife Jeanne, and the de (von) Hartmann's. He must have been a formidable personality to have left such an impression on Daumal. This book is a gem, even in its unfinished form, or maybe because of it.This book must have been revolutionary when it came out in the 1930s. The language, the style, the unbashed uncaring for literary norms must have been like a fresh air of rebellion to the stifled people of the 1930s who just few decades ago were under the moral oppression of the Victorian age. The book begins with an ode to Tanya's cunt. And it continues in the same manner. The word cunt is probably the most used word in the entire book. Today it would be called vulgar, but at the time it was revolutionary and brave. Miller describes multiple women he's had sex with while living in Paris, mostly on the money of other people, or as a vagrant and homeless on the streets. Most of the women he sleeps with are prostitutes (and he goes at length discussing the different types of prostitutes), but there is also the Jewish adulteress, the Russian princess with gonorrhea, the strange french woman to whom he gives 100 francs and then takes them out of her purse after having sex with her in her house above the room of her sick mother. Chapters of lucid description of characters (mostly Miller's friends whose money he uses, at whose houses he sleeps and whose women he has sex with) and some semblance of story lines are alternated with chapters of stream-of-consciousness monologues with prophetic statements and deep insights into life and living that usually come only after a very heavy intoxication with various substances. The book finishes in a middle of an action, just like it starts. Nothing really happens throughout and there's no sustained plot or even any novel-long characters (except the author-narrator) but it does give an entertaining and fascinating view into the life of the American emigres to Paris between the two wars in a much different way than Hemingway. POSTED BY MR.B. AT 2:12 PM NO COMMENTS: THURSDAY, JULY 7, 2016 "Mount Analogue" by Rene Daumal It ends in mid-sentence in the fifth chapter. Rene Daumal died days later of tubercolosis. He was in his 36th year of his life. Peradams. Only Father Sogol (Logos, took me a while to figure it out without anyone pointing it out to me) found one and very low, below the mountain where no Peradams are usually found, but he had an epiphany about himself. The book has an extensive intro section where the future planned chapters by Daumal are explained and it is a real shame that they were not written. Or maybe the book is more effective this way? After all Gurdjieff's "Life is real only when I AM" also stops in a middle of a sentence, and some who have seen the original manuscripts say that the published version is a much smaller selection from what was available. "Mount Analogue" is a very readable and well written book, to be expected from a writer of Daumal's caliber, and although Gurdjieff's name is never explicitly mentioned - it is based on the ideas and understanding of Gurdjieff's system (not to be called "The Fourth Way", but simply the "Gurdjieff System") and contains the personal thoughts and development of a person working on themselves according to the system. The explanation on how Mount Analogue would have been physically hidden from anyone for so long is definitely done by the latest science available at that period (1930s), but ..</div>
                                 <div class="col-md-2">
                                     <a href="#f" align="right" class="btn 
                                 btn-danger" role="button">Down
                                     </a>
                                 </div>
                      </div>
          </div>  
     <footer>
         <div class="container-fluid">
            <p><a id="f">All right unreserved</a></p>
         </div>
      </footer>
</body>
</html>

3 个答案:

答案 0 :(得分:2)

我建议的一种方法是使用flex

首先确保bodycontainerrowcol1即使在空的时候也占据全高(检查确认)。

如果有,请将col1设为display:flex。然后,您可以轻松地使用flex子项的flex-end属性使其保持原状。

#upButton {
 align-self: flex-end
}

答案 1 :(得分:1)

尝试将您的风格更改为此。输出可能是您要查找的结果。

<style>
  #upButton {position:fixed; left:0px; bottom:0px;}
  .col1 {height:100%;}
</style>

我将位置从绝对更改为固定,尝试读取位置的不同值... CSS Layout - The position Property

答案 2 :(得分:1)

修复 upButton ,我们可以控制它而不管它的父母如何这样我们就可以达到你的要求

ServerSocket sc=new ServerSocket(9999);
Socket s=sc.accept();
DataInputStream dos=new DataInputStream(s.getInputStream());
String msg=dos.readUTF();
System.out.println(msg);

现场演示:https://jsbin.com/kuberop/2/edit?html,output

相关问题