We are building a simple website in CSS to provide educational resources for other students here at my school. I have chosen to go with the Bootstrap Columns. The problem is on our school's desktop computers and tablets stacks the columns into different rows, instead of just shrinking the size down.
Here is all of the relevant HTML code:
<!-- Left Side Bar -->
<div style="background-color:#F3F8FC;" class="col-lg-2 mobile-hide" ><!-- Not Displayed on Mobile -->
<div class="fotd">
<div class="fotd-title">
<h4>Fact Of The Day</h4>
</div>
<p>Text</p>
</div>
<div class="twitter mobile-hide">
<a class="twitter-timeline" href="https://twitter.com/RHL_Inspire" data-widget-id="720721136867282945">Tweets by #RHL_Inspire</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
</div>
<!-- Center Content -->
<div class="col-lg-7 ">
<h3 class="content title">Letter from The Editor In Narwhal</h3>
<p class="content" >
This is a link. This is the actual link
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam lobortis,
</p>
</div>
<!-- Right Side -->
<div style="background-color:#F3F8FC;" class="col-lg-3 mobile-hide">
<h3 class ="center mobile-hide">Editors Picks!</h3>
<ul class="stickynote mobile-hide">
<li class="stickynote mobile-hide">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
<li class="stickynote">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
<li class="stickynote">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
<li class="stickynote">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
<li class="stickynote">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
<li class="stickynote">
<a class="stickynote" href="http://www.google.com">
Google
</a>
</li>
</ul>
</div>
<div class="row">
<div class="col-lg-12">
<footer>© 2016 The StickyNote | Google</footer>
</div>
</div>
The issue was that we had to change the code to specify two sizes of the column. For example in the original code we had:
<div style="background-color:#F3F8FC;" class="col-lg-7">
This had to be simply changed to:
<div style="background-color:#F3F8FC;" class="col-lg-7 col-sm-7">
The col-sm-7 gets used for smaller screens(such as Tablets and the lower-res desktop computers.
Related
In my case, my home page only consists of a menu and closed accordions, each href in the menu when clicked on, opens a specific accordion & this works good.
My question is, if I have the same menu in other pages, not the home page, how can I let it hyperlinks to the home page & opens the specific accordion? They told me it can be done using Local Storage, but I don't know how to use it, any help please?
JQUERY CODE
$(document).ready(function () {
$(".expand").on("click", function () {
$(".right-arrow").text("+");
$(".detail:visible").slideUp();
if (!$(this).next().is(":visible")) {
$(this).next().slideDown(200);
$(this).find(".right-arrow").text("-");
}
});
let click_state = localStorage.getItem("click_state");
let ind = localStorage.getItem("ind");
if (click_state == 1) {
$(".expand").eq(ind).trigger("click");
localStorage.removeItem("click_state");
localStorage.removeItem("ind");
} else {
}
$(".accord").each(function (index) {
$(this).click(function (event) {
event.preventDefault();
localStorage.setItem("click_state", 1);
localStorage.setItem("ind", index);
});
});
});
HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<a class="accord" href=""> Open 1st accordion </a> <br>
<a class="accord" href=""> Open 2nd accordion </a>
<div class="container">
<div class="row" id="accordion1">
<div id="trickslist">
<ul>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<div>
<h2 class="tipstricks">Exploring your Motivations to Quit Tobacco</h2>
</div>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">What to expect over time.</h2>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">Getting Ready: Strategies to conquer urges & set a quit date</h2>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">Quitting tobacco with medications</h2>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">Dealing with depression or stress</h2>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">Avoiding weight gain or alcohol</h2>
</a>
<div class="detail">
</div>
</li>
<li>
<a class="expand" data-parent="#accordion1">
<div class="right-arrow">+</div>
<h2 class="tipstricks">Making your plan stick: relapse prevention</h2>
</a>
<div class="detail">
</div>
</li>
</ul>
</div>
</div>
</div>
I have list that I render with semantic-ui and it needs some margin to the top for the first element. I looked in the CSS code and I see margin-top:0!important and I can override it for the first element with margin-top:10px!important; and then the rendering looks good. Is there a better way to achieve it? My code (without the fix) is
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<ul class="nav nav-tabs">
<li class="nav active">All
</li>
<li class="nav">Company
</li>
<li class="nav">Private
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="A">
<div class="ui divided items">
<div class="item">
<div class="ui left floated">
7 July.
<br>3:33
</div>
<div class="image">
<a href="/vi/5022701123010560.html">
<img src="http://lh3.googleusercontent.com/JZkr-b_aWlYrFG1G-EUywZgucJE3JV1wgz4yQGrx-bGaw_va7dymsaTMXhK5t6ZkUdjWLeHlNaiksVNAMp8I1epB-Q=s150" title="Wordpress development company, website developer" alt="Wordpress development company, website developer">
</a>
</div>
<div class="content">
<a class="header" href="/vi/5022701123010560.html">Wordpress development company, website developer</a>
<div class="meta">
<span class="price"></span>
</div>
<div class="description">
<p>Dit Interactive have experts wordpress ...</p>
</div>
<div class="extra">
<div class="ui label">
Services
</div>
<div class="ui label">
For sale
</div>
<div class="ui label">Central NJ</div>
<div class="ui label">New Jersey</div>
<div class="ui right floated primary button">
Buy now
<i class="right chevron icon"></i>
</div>
</div>
</div>
</div>
<div class="item">
<div class="ui left floated">
7 July.
<br>0:54
</div>
<div class="image">
<a href="/vi/5870511561113600.html">
<img src="http://lh3.googleusercontent.com/rsfBseoSy-KPg6P703Dknbpd0t2Ug4n2BY8oKkg2XH5dkufstmZXMWSCsHTU4C0yb7bIaMBpAFxILaW6W3lZsiCt=s150" title="Dentist in Westminster" alt="Dentist in Westminster">
</a>
</div>
<div class="content">
<a class="header" href="/vi/5870511561113600.html">Dentist in Westminster</a>
<div class="meta">
<span class="price"></span>
</div>
<div class="description">
<p>Pari J. Moazed, DDS is a family dentist ...</p>
</div>
<div class="extra">
<div class="ui label">
Services
</div>
<div class="ui label">
For sale
</div>
<div class="ui label">Baltimore</div>
<div class="ui label">Maryland</div>
<div class="ui right floated primary button">
Buy now
<i class="right chevron icon"></i>
</div>
</div>
</div>
</div>
</div>
This "solution" works, but I don't like it
<div {% if loop.index0 == 0 %}style="margin-top:10px!important"{% endif %} class="item">
By the looks of it I would personally just change the margin on the with the simple line:
.container .nav{
margin-top:10px;
}
Does this answer your question? (I know it looks too simple to be true)
I would suggest adding a custom class to <ul class='nav nav-tabs'>
<ul class="nav custom-class nav-tabs">
and adding margin-bottom to it
.custom-class{
margin-bottom:20px;
}
We are adding a custom class to unordered list <ul> so that changes made to it doesn't effect other elements which are using nav class
On your div.tab-content try adding class ui basic segment
I know it is waaay overdue, but I came across this thread when looking for the same issue in Semantic UI React. My solution was to add a divider above the first container:
<Divider hidden></Divider>
I would like to have three single column list-group's on my page and allow the user to select an item from each group. However, the list-groups are all linked and I haven't been able to figure out how to keep them as individual list-groups.
I setup up a quick Plunker link here so you could see what I'm trying to do.
I'm also not sure why each column of lists is offset by the previous column.
Here's the HTML that I'm playing with as I try to figure out how to do this:
<div class="container">
<h3>
Select one from each column.
</h3>
<div>
<h3 class="list-group-item-heading">Select Opp</h3>
</div>
<div id="oppname" class="col-md-4 list-group">
<div class="no-margin">
<a href="#" class="list-group-item">
Aelia
</a>
</div>
<div class="no-margin">
<a href="#" class="list-group-item">
Del Monte
</a>
</div>
</div>
<div>
<h3 class="list-group-item-heading">Select Id</h3>
</div>
<div id="oppid" class="col-md-4 list-group">
<div class="no-margin">
<a href="#" class="list-group-item">
Id: 1724
</a>
<div class="no-margin">
<a href="#" class="list-group-item">
Id: 1675
</a>
</div>
</div>
</div>
<div>
<h3 class="list-group-item-heading">Select Size</h3>
</div>
<div id="oppsize" class="col-md-4 list-group">
<div class="no-margin">
<a href="#" class="list-group-item">
Size: 24
</a>
<div class="no-margin">
<a href="#" class="list-group-item">
Size: 75
</a>
</div>
</div>
</div>
</div>
Thanks for you help!
Yes, its weird that it doesn't work by default groupings.
Here is a solution in Fiddle
<div class="list-group">
One
Two
Three
</div>
<div class="list-group">
One
Two
Three
</div>
<div class="list-group">
One
Two
Three
</div>
and add this sibling js to do the selection like this
$('body').on('click', '.list-group a', function (e) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
});
and Viola.
I am using angularjs to render my html and using bootstrap 3 to style it. The tabs render correctly, but the images within each tab do not display in a grid, rather, they are outputted one by one in a single column. What am I doing wrong?
<div class="col-sm-12">
<!--Nav Tabs-->
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="{{'#' + retailProducts[0].Category}}"
role="tab" data-toggle="tab">
{{retailProducts[0].Category}}
</a></li>
<li ng-repeat="pro in retailProductsMinusFirst">
<a href="{{'#' + pro.Category}}" role="tab" data-toggle="tab">
{{pro.Category}}
</a>
</li>
</ul>
<!--Tab Panes-->
<div class="tab-content">
<div class="tab-pane active" id="{{retailProducts[0].Category}}">
<div class="row">
<div class="col-sm-2">
<a ng-repeat="pro in retailProducts[0].Products" href="#"
class="thumbnail">
<img src="{{pro.Product.PrimaryPhotoUrl + '?height=100'}}"
alt="Product Photo" />
</a>
</div>
</div>
</div>
<div ng-repeat="pro in retailProductsMinusFirst" class="tab-pane"
id="{{pro.Category}}">
<div class="row">
<div class="col-sm-2">
<a ng-repeat="img in pro.Products" href="#" class="thumbnail">
<img src="{{img.Product.PrimaryPhotoUrl + '?height=100'}}"
alt="Product Photo" />
</a>
</div>
</div>
</div>
</div>
</div>
You're repeating the anchors. You need to repeat the column divs. Something like this:
<div ng-repeat="pro in retailProducts[0].Products" class="col-sm-2">
<a href="#" class="thumbnail">
<img src="{{pro.Product.PrimaryPhotoUrl + '?height=100'}}"
alt="Product Photo" />
</a>
</div>
I am using the plugin Glide.js on my frontpage, and I have build it up almost like shown on the plugin page. This also means that I wish my slider images to have 100% width, but at the same time I want them to be cropped/cut off at the bottom at the window. Precisely like it is don on the plugin page.
My html code looks like this:
<header class='header'>
<div class='header-wrapper'>
<img class='header-logo' src='/assets/glide-logo-cfe0cb95a81b55ff1e872b0c578c527d.png'>
<nav class='header_nav'>
<ul class='header_nav-wrapper'>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#' id='aboutOpen'>About us</a>
</li>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#'>Create account</a>
</li>
<li class='header_nav-item'>
<form>
<button class='header_nav-item-a header_nav-item-a--btn header_nav-item-a--donate' src='https://www.paypalobjects.com/en_US/i/btn/'>Login</button>
</form>
</li>
</ul>
</nav>
</img>
</div>
</header>
<div class='slider'>
<div class='slides'>
<div class='slide content_article content_article--fast'>
<center>
<img class='slider-img' src='/assets/bg-fast-219ed63d5978022b88ba2389b4f673b6.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 1</h1>
<p class='content_article-p'>
Sub title 1
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 1
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 1</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/fast-img-3d905c8a57b66ef354467a9a0a07d168.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--simple'>
<center>
<img class='slider-img' src='/assets/bg-responsive-07aefbc31666790f38a6e3e3b46f67a8.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 2</h1>
<p class='content_article-p'>
Sub title 2
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 2
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 2</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/responsive-img-662aaea9b8453dc6eac46064fdcc7a56.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--responsive'>
<center>
<img class='slider-img' src='/assets/bg-simple-2d45eb663c4c69d72f66c19eb0cce285.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 3</h1>
<p class='content_article-p'>
Sub title 3
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 3
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 3</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/simple-img-af275d5091063498174655c95fa41079.png'>
</div>
</center>
</div>
</div>
</div>
My css is very simple, but only handles the 100% width stretch:
.slider-img {
width: 100%;
}
So how do I cut off my slider images so they fit the height of the screen?
Here is the CSS
.crop{
float:left;
margin:.5em 10px .5em 0;
overflow:hidden; /* this is important */
border:1px solid #ccc;
}
/* input values to crop the image */
.crop img{
margin:-20px -15px -40px -55px;
}