Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

html - Slide in DIV from the right in CSS? CoolBlue example

Ok, is this possible in CSS only? Check https://www.coolblue.nl/televisies and click the word: 'Advies' in the light blue menu. You'll see a new page on the right side appear with extra information without you actually leaving the productpage. This is exactly what I need, but it has to be pure CSS.

Is something like this even possible?

question from:https://stackoverflow.com/questions/65845946/slide-in-div-from-the-right-in-css-coolblue-example

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is possible, but it depends on what do you want to achieve.

A simple way would be to use the checkbox hack to simply create a hidden checkbox, and a lable for it, whick contains the block to display when the button is clicked. It could be something like this:

#controllbox {
    display: none;
}

.infopage{
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  width: 200px;
  height: 100%;
  background-color: lightblue;
  display: none;
}

#controllbox:checked + label > .infopage {
    display: block;
}
<input type="checkbox" id="controllbox"/>
<label class="linkbutton" for="controllbox">
  Click me!
  <div class="infopage">
    here the text in the info box .....
  </div>
</label>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...