如何减小此 div 的宽度,以便另一个 div 可以紧挨着它?

How to decrease the width of this div so that another div can come next to it?

最初this was an SSCCE,我想对其进行更改。变化是,我希望有一个 "inline" 兄弟 div 添加 next.first-page,我们称它为 .first-page-sib,这样.first-page 缩小了一点(可能让我们对其应用 overflow-x:scroll)width-wise 和几个像素,为了这个例子 65px,被.first-page-sib.

所以我在 div.first-sib 旁边添加了一个 div.first-page-sib,为它们添加了一些 CSS 属性,将它们包裹在 div.wrapper 中。 div.first-page-sib 没有出现。但是一旦我添加 position:absolute; 就出现了。

但现在的问题是它出现在 .first-page 之上,即注意红色 div 与 header 中的单词 ELE 重叠。我想要的是使 .first-page 横向变小,以便 .first-page-sib 可以紧挨着它。

我怎样才能做到这一点?

JSFiddle here.

.wrapper {
    height:100%;
}

.first-page {
    vertical-align:top;
    display:inline-block;
    width:95%;
}

.first-page-sib {
    vertical-align:top;
    background-color:red;
    width:65px;
    height:100%;
    position:absolute;
    display:inline-block;
    right:0px;
}


/******************************************************/

.header-element {
    height:70px;
    width:100%;
    top:0px;
    left:0px;
    opacity:0.6;
    background-color:brown;
    z-index:1000;
    position:absolute;
    text-align:right;
}

.header-element p {
    padding:5px 50px;
    color:yellow;
    font-family:sans-serif;
    font-weight:bold;
    font-size:20px;
}

/******************************************************/

html, body {
 height:100%;
}

.first-page {
 height:100%;
}

#imageSlideshowContainer img {
 top:0px;
 left:0px;
 position:fixed;
 width:100%;
 display:none;
 
 height:100%; /*If I don't set this, the image just remains small, confined within the first viewport in the browser, it doesn't for example peep through the translucence of the footer and other sections.*/
}

#imageSlideshowContainer img.slider-image1 {
 display:block;
}

.captionSlideshowContainer { /*same as first-viewport*/
 width:100%;
 display:table;
 /*top:0px;*/
 
 height:100%;
}

.previous-slide-arrow, .next-slide-arrow {
 display:table-cell;
 vertical-align:middle;
 position:relative;/*wat if not?*/
 color:white;
 text-align:left;
 text-decoration:none;
 background-repeat:no-repeat;
 background-position:center center;
 left:20px;
 width:3%;
 
 font-size:50px;
 font-weight:bold;
}

.next-slide-arrow {
 left:auto;
 right:20px;
 text-align:right;
}

.central-content-container {
 display:table-cell;
 text-align:center;
 vertical-align:bottom;
 position:relative;
 bottom:30px;
 padding:20px 5px;
}

/* UPDATED THIS - ABSOLUTE POSITION */
.slider-text-wrapper span {
 display:none;
    position:absolute;
    bottom:0;
    width:100%;
    left:0;
}

.caption1 {
 display:block;
}

.slider-text-wrapper span h3 {
 text-transform:uppercase;
 font-size:68px;
 font-weight:bold;
 font-family: sans-serif;
 color:orange;
 line-height:60px;
}

.slider-text-wrapper span p {
 font-size:20px;
 font-weight:100;
 font-family: sans-serif;
 color:white;
 line-height:60px;
}

.central-content-container a {
 width:6px;
 height:6px;
 display:inline-block;
 margin-right:16px;
 background: white none repeat scroll 0% 0%;
 border-radius:100%;
 color:transparent;
}

.central-content-container a.active {
 background:yellow;
}
<div class="header-element">
    <p>ELE</p>
</div>


<!--  --------------------------------------  -->
<div class="wrapper">


<div class="first-page">
      <div id="imageSlideshowContainer" class="image-slideshow-container">
       <img class="slider-image1" src="http://www.stadiumsofprofootball.com/nfc/images/candold2.jpg" alt="pixer!" /> 
       <img class="slider-image2" src="http://www.bryantpark.org/static/galleries/history/18.jpg" alt="pixer!" /> 
       <img class="slider-image3" src="http://www.legendsofamerica.com/photos-CO-Misc/CheesmanPark.jpg" alt="pixer!" /> 
       <img class="slider-image4" src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Sportsman's_Park_1946_World_Series-1.jpg" alt="pixer!" /> 
       <img class="slider-image5" src="http://www.ballparksofbaseball.com/past/images/cand13959.jpeg" alt="pixer!" /> 
       <img class="slider-image6" src="https://upload.wikimedia.org/wikipedia/commons/3/38/Central_Park_New_York_City_New_York_8.jpg" alt="pixer!" /> 
      </div>


      <div class="captionSlideshowContainer first-viewport">
       <a class="previous-slide-arrow" href="#">&lt;</a>
       
       <div class="central-content-container">
        <div class="slider-text-wrapper">
         <span class="caption1" style="display:block;" ><h3>alpha alpha alpha</h3></span>
         <span class="caption2" ><h3 >beta beta beta</h3></span>
         <span class="caption3" ><h3>Gamma gamma Gamma</h3></span>
         <span class="caption4" ><h3>Delta delta Delta</h3></span>
         <span class="caption5" ><h3>Epsilon epsilon</h3></span>
         <span class="caption6" ><h3>Neither Either Whatever</h3></span>
        </div>
        <!--<div class="learn-more-link-wrapper">
         <img class="learn-more-image" src="http://localhost/moodle/theme/crystal/pix/headings/learn-more-image.png" />
        </div>-->
        <div class="navigation-bullets-wrapper">
         <a class="active navigation-bullet1" href="javascript: changeImage(1)"><span>Bullet</span></a>
         <a class="navigation-bullet2" href="javascript: changeImage(2)"><span>Bullet</span></a>
         <a class="navigation-bullet3" href="javascript: changeImage(3)"><span>Bullet</span></a>
         <a class="navigation-bullet4" href="javascript: changeImage(4)"><span>Bullet</span></a>
         <a class="navigation-bullet5" href="javascript: changeImage(5)"><span>Bullet</span></a>
         <a class="navigation-bullet6" href="javascript: changeImage(6)"><span>Bullet</span></a>
        </div>
       </div>
       
       <a class="next-slide-arrow" href="#">&gt;</a>
      </div> <!-- .first-viewport -->
     
     </div> <!-- .first-page -->
    
    <div class="first-page-sib">.</div>
    
</div><!--.wrapper-->

     <p style="background-color:pink; opacity:0.5;">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.
     
        The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

        It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
        
     Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.
     
     The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
     
     There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>

我会尝试在所有其他 div 上创建一个 div 作为 table。 然后将其他定义为table-rows

.div-table{
  display:table;         
}
.div-table-row{
  display:table-row;
}

How create table only using <div> tag and Css

你可以试试 css3 计算 width: calc(100% - 65px);-

.first-page {
    vertical-align: top;
    display: inline-block;
    width: calc(100% - 65px);
}
.header-element p {
    padding: 5px 50px;
    color: #FF0;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 20px;
    float: right;
    margin-right: 25px;
    width: 100%;
}