Horizontal scrolling using CSS - html

So I am trying to accomplish horizontal scrolling for a client using just CSS (I know there are a lot of JavaScript libraries out there that help with this but I'm trying to avoid those).
I have some basic code down (thanks to help from this link and the JSFiddle therein: CSS horizontal scroll) but am unable to actually make it work.
Here is my example code that I am trying to work with: http://jsfiddle.net/8Bkxh/
HTML:
<section class="row">
<div class="scroll-wrap">
<div class="span4">
<div class="video-list">
<div class="vid-thumb-wrap">
<img class="thumbnail stretch moveback" src="<?php echo base_url('assets/img/video-screenshot.png');?> ">
<div class="vid-title">
<h5>In-Studio Tutorial On Recording</h5>
<p>By David Boone</p>
</div><!-- .vid-title -->
<div class="callout upcoming">
<p>Purchase Tickets Now!</p>
</div><!-- .callout upcoming -->
</div><!-- .vid-thumb-wrap -->
</div><!-- .video-list -->
</div><!-- .span4 -->
<div class="span4">
<div class="video-list">
<div class="vid-thumb-wrap">
<img class="thumbnail stretch moveback" src="<?php echo base_url('assets/img/video-screenshot2.jpg');?> ">
<div class="vid-title">
<h5>[Interview] The Revolution of Individual Production</h5>
<p>By Jon Foreman</p>
</div><!-- .vid-title -->
<div class="callout live">
<p>Happening Now!</p>
</div><!-- .callout live -->
</div><!-- .vid-thumb-wrap -->
</div><!-- .video-list -->
</div><!-- .span4 -->
<div class="span4">
<div class="vid-thumb-wrap">
<img class="thumbnail stretch moveback" src="<?php echo base_url('assets/img/video-screenshot3.jpg');?> ">
<div class="vid-title">
<h5>Q&A From Lengendary Pottery Teacher</h5>
<p>By George Alexson</p>
</div><!-- .vid-title -->
<div class="callout limited">
<p>Only 5 Tickets!</p>
</div><!-- .callout limited -->
</div><!-- .vid-thumb-wrap -->
</div><!-- .span4 -->
<div class="span4">
<div class="vid-thumb-wrap">
<img class="thumbnail stretch moveback" src="<?php echo base_url('assets/img/video-screenshot3.jpg');?> ">
<div class="vid-title">
<h5>Q&A From Lengendary Pottery Teacher</h5>
<p>By George Alexson</p>
</div><!-- .vid-title -->
<div class="callout limited">
<p>Only 5 Tickets!</p>
</div><!-- .callout limited -->
</div><!-- .vid-thumb-wrap -->
</div><!-- .span4 -->
<div class="span4">
<div class="vid-thumb-wrap">
<img class="thumbnail stretch moveback" src="<?php echo base_url('assets/img/video-screenshot3.jpg');?> ">
<div class="vid-title">
<h5>Q&A From Lengendary Pottery Teacher</h5>
<p>By George Alexson</p>
</div><!-- .vid-title -->
<div class="callout limited">
<p>Only 5 Tickets!</p>
</div><!-- .callout limited -->
</div><!-- .vid-thumb-wrap -->
</div><!-- .span4 -->
</div><!-- .scroll-wrap -->
</section><!-- .row -->
CSS:
.row {
position: relative;
width: 960px!important;
}
.scroll-wrap {
overflow-x: scroll;
overflow-y: hidden;
height: 180px!important;
white-space: nowrap!important;
}
Be sure to check the three external resources I have linked in that JSFiddle
All I want to do is allow the user to scroll through these five items horizontally not vertically.
I think I'm just having a mental block somewhere and I hope this may be a quick fix for somebody out there. I really appreciate any and all help where possible and I would be happy to clarify where possible.
Thanks,
Keenan

I've experienced this issue before and solved it by setting the inner divs to display: inline-block and extend the containing div with white-space: nowrap like you already did.
Works, but I don't have an idea why your solution does not work. I am quite sure I used this for some years in the same way and at some point it just stopped working.
Edit:
In case of bootstrap, you might want to explicitely set the float value to none

Related

Split layout for HTML screen, content below not visible

I am trying to create a Split Layout using https://tympanus.net/codrops/2013/10/25/split-layout/
However, I am unable to see the contents below the split view. I am able to scroll but cannot see contents of element id "services". I am not posting the CSS in order to avoid making it readable. The CSS can be found on the link above. Thank you.
<div id="splitlayout" class="splitlayout">
<div class="intro">
<div class="side side-left">
<header class="codropsheader clearfix">
<span>Blueprint <span class="bp-icon bp-icon-about" data-content="The Blueprints are a collection of basic and minimal website concepts, components, plugins and layouts with minimal style for easy adaption and usage, or simply for inspiration."></span></span>
<h1>Split Layout</h1>
<nav>
<span>Previous Blueprint</span>
<!--a href="" class="bp-icon bp-icon-next" data-info="next Blueprint"><span>Next Blueprint</span></a-->
<span>back to the Codrops article</span>
<span>Go to the archive</span>
</nav>
<div class="demos">
<a class="current" href="index.html">Effect 1</a>
Effect 2
</div>
</header>
<div class="intro-content">
<div class="image-container">
<img class="img-fluid" src ={% static "images/teacher-4.png" %} alt="alternative">
</div>
<h1><span>Toby Blue </span><span>Web Designer</span></h1>
</div>
<div class="overlay"></div>
</div>
<div class="side side-right">
<div class="intro-content">
<div class="image-container">
<img class="img-fluid" src ={% static "images/student-2.png" %} alt="alternative">
</div>
<h1><span>Amy White </span><span>Web Developer</span></h1>
</div>
<div class="overlay"></div>
</div>
</div><!-- /intro -->
<div class="page page-right">
<div class="page-inner">
<section>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
</div><!-- /page-inner -->
</div><!-- /page-right -->
<div class="page page-left">
<div class="page-inner">
<section>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
</div><!-- /page-inner -->
</div><!-- /page-left -->
→
←
</div><!-- /splitlayout -->
<!-- Services -->
<div id="services" class="cards-1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Create an eQuiz and schedule it in less than 1 minute.</h2>
<p class="p-heading p-large">Now all you need are a few clicks and your students get an eQuiz</p>
</div> <!-- end of col -->
</div> <!-- end of row -->
<div class="row">
<div class="col-lg-12">
<!-- Card -->
<div class="card">
<img class="card-image" src ={% static "images/employee.svg" %} alt="alternative">
<div class="card-body">
<h4 class="card-title">Pick Difficulty & Topic</h4>
<p>The questions and quiz comes with a level of difficulty and spread across all chapters </p>
</div>
</div>
<!-- end of card -->
<!-- Card -->
<div class="card">
<img class="card-image" src ={% static "images/quiz-icon.svg" %} alt="alternative">
<div class="card-body">
<h4 class="card-title">Random Q&A</h4>
<p>Students get random questions and options from our huge pool of questions</p>
</div>
</div>
<!-- end of card -->
<!-- Card -->
<div class="card">
<img class="card-image" src ={% static "images/quiz-2.svg" %} alt="alternative">
<div class="card-body">
<h4 class="card-title">Different Options</h4>
<p> You can test students on MCQ, True/False & Essay Type Questions </p>
</div>
</div>
<!-- end of card -->
</div> <!-- end of col -->
</div> <!-- end of row -->
</div> <!-- end of container -->
</div> <!-- end of cards-1 -->
<!-- end of services -->
Change the position: fixed; on .side to position: absolute;.
.side {
position: absolute;
top: 0;
z-index: 100;
width: 50%;
height: 100%;
text-align: center;
-webkit-backface-visibility: hidden;
}
Check it in action on Codepen: https://codepen.io/manaskhandelwal1/pen/YzpWvaZ

CSS - Left and Right DIV with 100% width

I am currently using a Bootstrap for my website with a left sideBar navigation.
At the main content, i have 2 container for left and right content.
What I want is like the image below and i already done this:
and when the toggle button is clicked then the `rightDiv` will resize
which is my main problem and i'm not able to do:
and when the browser/device is small lets say mobile device then it be
like this and i already done this.
I am able to do the first and third image but failed at the second image which will resize the rightDiv on toggle button clicked.
so far i have this in my HTML:
<div id="wrapper">
<!--Start of Sidebar navigation -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li>
<span>Home</span>
</li>
....
</ul>
</div>
<!-- End of Sidebar navigation-->
<!-- Start Main Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<!--START OF LEFT DIV-->
<div class="row-post-container">
</div>
<!--END OF LEFT DIV-->
</div>
<!--START OF RIGHT DIV-->
<div class="main-right-side-container">
<div class="right-side-container">
....
</div>
</div>
<!--END OF RIGHT DIV-->
</div>
</div>
</div>
<!-- END Main Content -->
</div>
and in my CSS i have this for left and right sidebar of DIV:
.row-post-container{
display: table-cell;
float: left;
max-width: 800px;
width: 100%;
min-width: 300px;
margin-right: 20px;
}.main-right-side-container{
display: table-cell;
min-width: 300px;
width: 100%;
max-width: 300px;
vertical-align: top;
height: 300px;
float: left;
padding: 0px;
margin-top: 20px;
}
Anyone has an idea?
For more clarification please do ask me.
Please suggest only CSS.
Thak you very much.
EDIT: the orange is leftDiv and dark green at the right side of orange is RightDiv.
One of the main things you are not considering is having bootstrap columns.
I have modified the example link you gave me and duplicated to have the two columns instead of one. By default, this is the current skeleton or rather structure of the code in the example -
Current Implementation on the example site
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<!-- your code here -->
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
Change to add columns like below -
In here, i suggest you should go on about adding more columns like so -
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-8"> <!-- your leftDiv code here --> </div>
<div class="col-lg-4"> <!-- your rightDiv code here --> </div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
First try to make full use of bootstrap classes, check this-
HTML-
<p><input type="button" id="showHideBtn" value="Slide Menu"></p>
<div id="sidebar-wrapper col-md-3">
<ul class="sidebar-nav">
<li>
<span>Home</span>
</li>
....
</ul>
</div>
<div id="page-content-wrapper" class="col-md-9">
<div class="container-fluid">
<div class="row">
<!--START OF LEFT DIV-->
<div class="col-xs-12 col-md-9 row-post-container">
</div>
<!--END OF LEFT DIV-->
<!--START OF RIGHT DIV-->
<div class="col-xs-12 col-md-3 main-right-side-container">
</div>
<!--END OF RIGHT DIV-->
</div>
</div>
</div>
CSS -
.hide{display:none !important;}
JS -
$('#showHideBtn').click(function(e){
$('#sidebar-wrapper').toggleClass('hide');
if($('#page-content-wrapper').hasClass('col-md-9')){
$('#page-content-wrapper').removeClass('col-md-9');
}else{
$('#page-content-wrapper').addClass('col-md-9');
}
});

Paragraph text using img space

I'm trying to make the whole thing clickable so I wrapped the image and paragraph inside an anchor tag. I gave the anchor tag a padding of 40px around and gave the img tag a right margin of around 30. Both of them have a display property of inline-block. The problem is it doesn't show like the one on the image(attached). How do I fix this? I'm not that good at CSS and HTML yet. Thanks.
<div class="col-md-3">
<img src="_assets_/images/icon-meeting.png" alt="meeting minutes and agendas"><p>Meeting Minutes & Agendas</p>
</div><!-- /.col-md-3 -->
<div class="col-md-3">
<img src="_assets_/images/icon-bills.png" alt="pay bills online"><p>Pay Bills Online</p>
</div><!-- /.col-md-3 -->
<div class="col-md-3">
<img src="_assets_/images/icon-document.png" alt="form & document center"><p>Form & Document Center</p>
</div><!-- /.col-md-3 -->
<div class="col-md-3">
<img src="_assets_/images/icon-questions.png" alt="frequently asked questions"><p>Frequently Asked Questions</p>
</div><!-- /.col-md-3 -->
My CSS is:
#panel p {font-family: 'Raleway', sans-serif;color: #fff;font-size: 18px;display: inline-block;margin: 0}
#panel img {width: 45px;margin-right: 25px;display: inline-block}
#panel a {background-color: #1b4952;display: block;border-radius: 10px;text-decoration: none}
What I want
What I have
I guest you use bootstrap :)
About that you can make it using row. I just simple edit your code check and try it i hope it's help you.
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
<a href="./"><img src="_assets_/images/icon-meeting.png" alt="meeting minutes and agendas">
<div class="col-md-6">
<p>Meeting Minutes & Agendas</p></a>
</div>
</div>
</div>
</div><!-- /.col-md-3 -->
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
<a href="./">
<img src="_assets_/images/icon-bills.png" alt="pay bills online">
<div class="col-md-6">
<p>Pay Bills Online</p></a>
</div>
</div>
</div>
</div>
<!-- /.col-md-3 -->
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
<a href="./">
<img src="_assets_/images/icon-document.png" alt="form & document center">
<div class="col-md-6">
<p>Form & Document Center</p></a>
</div>
</div>
</div>
</div><!-- /.col-md-3 -->
<div class="col-md-3">
<div class="row">
<div class="col-md-6">
<a href="./"><img src="_assets_/images/icon-questions.png" alt="frequently asked questions">
<div class="col-md-6"><p>Frequently Asked Questions</p></a>
</div>
</div>
</div>
</div><!-- /.col-md-3 -->
More informations check this page

Fix scroll on content while menu is expanded

Im trying to make a mobile menu scrollable while keeping page content at a fixed point when both are open. You will notice the undesired visibility of the scrolling of the menu through the bottom of the page
JS FIDDLE
<div class="navigation mobile">
<div class="menu-wrap">
<div class="project-tile">
<div class="copy">
<h2>Title</h2>
View project
</div><!-- /copy -->
</div><!-- /project-tile -->
<div class="project-tile">
<div class="copy">
<h2>Title</h2>
View project
</div><!-- /copy -->
</div><!-- /project-tile -->
</div><!-- /menu-wrap -->
</div><!-- /navigation -->
<input type="checkbox" id="nav-trigger" class="nav-trigger mobile" />
<label class="mobile" for="nav-trigger">Menu</label>
<div id="content" class="site-wrap">
Copy</div>
</div>
Try changing the positioning of the navigation element and adding an overflow-scroll, like so
.navigation
{
position: fixed;
overflow-y: scroll;
}
http://jsfiddle.net/x64c1L83/3/

Bootstrap rawspan and column span

Can anybody help me with this problem, I am using bootstrap to develop my website and so far I have two row`s.
<section role="main">
<div class="container">
<div class="row no-space"><!-- Row 1 -->
<div class="span3">
<h2>{ logo here }</h2>
<h3>[ logo here ]</h3>
</div>
<div class="span6">
<h2>Text here, text here <em>text here</em>...</h2>
<h2>text here!</h2>
</div>
<div class="span3">
<img src="img/coffee.png" alt="Coffee and code">
</div>
</div><!-- /Row 1 -->
<div class="row no-space"><!-- Row 2 -->
<div class="span3">
<img src="img/code01.png" alt="Coda2 code">
</div>
<div class="span3">
<img src="img/code01.png" alt="Coda2 code">
</div>
</div><!-- /Row 2-->
</div><!-- Container -->
</section><!-- MAIN -->
The entire website will be built using span3 and 6, with a height of 220 for span3 and 460 for span6. Because span6 has a double height as against span 3, it will be a gap of 240px between the span3 from the first row and the first span3 from the secound row.
How I can remove this gap, I tried nesting but is not really something that I need, because the divs(span3) will be shuffled every time the website will be reloaded.
Thank you for your time and help.
I think what u want to do is think of the spans as columns and add the data inside of the columns
<section role="main">
<div class="container">
<div class="row no-space"><!-- Row 1 -->
<div class="span3">
<h2>{ logo here }</h2>
<h3>[ logo here ]</h3>
<img src="img/code01.png" alt="Coda2 code">
</div>
<div class="span6" data-rowspan="2" data-colspan="2">
<h2>Text here, text here <em>text here</em>...</h2>
<h2>text here!</h2>
</div>
<div class="span3">
<img src="img/coffee.png" alt="Coffee and code">
<img src="img/code01.png" alt="Coda2 code">
</div>
</div><!-- /Row 1 -->
</div><!-- Container -->