I'm coding using the Front-ENd Web Development [The Big Nerd Ranch Guide] book to help me better understand css and javascript. There's a project where I'm learning how to use media queries and im suppose to changed the flex-direction property from a row to a column. I've copied the code as its shown and for some odd reason the code doesn't change the direction. It Follows everything before and after that piece of code. I'm hoping a extra pair of eyes can help me spot where I went wrong and help me understand media-queries & flexbox better.
<main class="main-content">
<ul class="thumbnail-list">
<li class="thumbnail-item">
<a href="#">
<img src="img/otter1.jpg" alt="Barry The Otter" class="thumbnail-image">
<span class="thumbnail-title">Barry</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter2.jpg" alt="Robin The Otter" class="thumbnail-image">
<span class="thumbnail-title">Robin</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter3.jpg" alt="Maurice The Otter" class="thumbnail-image">
<span class="thumbnail-title">Maurice</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter4.jpg" alt="Lesley The Otter" class="thumbnail-image">
<span class="thumbnail-title">Lesley</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter5.jpg" alt="Barbara The Otter" class="thumbnail-image">
<span class="thumbnail-title">Barbara</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter1.jpg" alt="Barry The Otter" class="thumbnail-image">
<span class="thumbnail-title">Barry</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter2.jpg" alt="Robin The Otter" class="thumbnail-image">
<span class="thumbnail-title">Robin</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter3.jpg" alt="Maurice The Otter" class="thumbnail-image">
<span class="thumbnail-title">Maurice</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter4.jpg" alt="Lesley The Otter" class="thumbnail-image">
<span class="thumbnail-title">Lesley</span>
</a>
</li>
<li class="thumbnail-item">
<a href="#">
<img src="img/otter5.jpg" alt="Barbara The Otter" class="thumbnail-image">
<span class="thumbnail-title">Barbara</span>
</a>
</li>
</ul>
______________________________________________________________________________
CSS
#media all and (min-width: 768px){
.main-content{
flex-direction: row;
overflow: hidden;
}
.thumbnail-list{
flex-direction: column;
margin-left: 20px;
order: 0;
}
.thumbnail-item{
max-width: 260px;
}
.thumbnail-item + .thumbnail-item{
margin-top: 20px;
}
}
Add display:flex; at the top of class thumbnail-list in the css. This should solve the problem. At the moment you don't seem to be telling the css to use flexbox in the first place.
Related
I need to make a second level of navbar appear from the top of the dropdown container, like this:
What I need to do
However, I only managed to do it like this(immigrations link hovered), using flexbox:
What I have done
And here is code that I have used:
.nav-more {
display: flex;
}
.more-dropdown {
position: relative;
display: flex;
}
.more-dropdown-content {
position: absolute;
display: flex;
flex-direction: column;
visibility: hidden;
}
.nav-more:hover .more-dropdown-content {
visibility: visible;
}
<div class="nav-more">
<a href="price.html" class="dropdown-link">
<p>Immigrations<img src="images/arrow-right.svg" class="dropdown-arrow"></p>
</a>
<div class="nav-more">
<div class="more-dropdown-content">
<a href="#" class="dropdown-link">
<p>1</p>
</a>
<a href="#" class="dropdown-link">
<p>2</p>
</a>
<a href="#" class="dropdown-link">
<p>3</p>
</a>
<a href="#" class="dropdown-link">
<p>4</p>
</a>
<a href="#" class="dropdown-link">
<p>5</p>
</a>
<a href="#" class="dropdown-link">
<p>6</p>
</a>
</div>
</div>
</div>
I am not clear on your question's code if you could send some more HTML and CSS but as far as I understand I think something like this must work
<div>//make it flex and direction column
<div> // make it flex and direction row
<div>
<div class="nav-more">
<a href="price.html" class="dropdown-link">
<p>Immigrations<img src="images/arrow-right.svg" class="dropdown-arrow"></p>
</a>
<div class="nav-more">
<div class="more-dropdown-content">
<a href="#" class="dropdown-link">
<p>1</p>
</a>
<a href="#" class="dropdown-link">
<p>2</p>
</a>
<a href="#" class="dropdown-link">
<p>3</p>
</a>
<a href="#" class="dropdown-link">
<p>4</p>
</a>
<a href="#" class="dropdown-link">
<p>5</p>
</a>
<a href="#" class="dropdown-link">
<p>6</p>
</a>
</div>
</div>
</div></div></div>
I'm currently struggling with the bulma navbar. This is my header:
<header class="navbar">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item">
<span class="icon has-text-primary is-large">
<i class="mdi mdi-36px mdi-hexagon-multiple"></i>
</span>
<!-- <h1 class="title is-1">DNW</h1> -->
</a>
<span class="navbar-burger burger" data-target="navbarMenuHeroC">
<span></span>
<span></span>
<span></span>
</span>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item">
Home
</a>
<a class="navbar-item">
Forum
</a>
<a class="navbar-item">
Spiele
</a>
<div class="navbar-item has-dropdown is-hoverable is-arrowless">
<div class="navbar-link">
<img class="nav-profilepic" src="https://static.wixstatic.com/media/1bfda4_6f8ae00a346644a89245f331fc6c6b8e~mv2_d_3476_5214_s_4_2.jpeg?dn=">
Tränenreich
</div>
<div class="navbar-dropdown">
<a class="navbar-item">
Profil
</a>
<a class="navbar-item">
Nachrichten
</a>
<a class="navbar-item">
Rangliste
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Hilfe
</a>
<a class="navbar-item">
Einstellungen
</a>
<a class="navbar-item">
Mod-Forum
</a>
</div>
</div>
</div>
</div>
</div>
</header>
The dropdown menu should show a blue arrow. But it doesn't show in Chrome nor in Firefox. Any ideas how to fix this?
I'd expect the output to show a dropdown arrow on the right next to "Tränenreich". Hovering works perfectly fine.
Greetings
Your code combined with an unedited Bulma file is showing an arrow next to the dropdown item. See demo below (you'll have to see full page perhaps because nav is changed to hamburger menu from tablet down).
My guess is either you've edited the Bulma CSS in a way that is breaking the arrow OR you have some custom CSS that is conflicting with it.
The arrow is created using a :after pseudo element.
.navbar-link:not(.is-arrowless)::after,
.select:not(.is-multiple):not(.is-loading)::after {
border: 3px solid transparent;
border-radius: 2px;
border-right: 0;
border-top: 0;
content: " ";
display: block;
height: .625em;
margin-top: -.4375em;
pointer-events: none;
position: absolute;
top: 50%;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: center;
transform-origin: center;
width: .625em;
}
Check your custom CSS to see if you have anything that is styling :after elements that is affecting the nav-item.
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css" rel="stylesheet"/>
<header class="navbar">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item">
<span class="icon has-text-primary is-large">
<i class="mdi mdi-36px mdi-hexagon-multiple"></i>
</span>
<!-- <h1 class="title is-1">DNW</h1> -->
</a>
<span class="navbar-burger burger" data-target="navbarMenuHeroC">
<span></span>
<span></span>
<span></span>
</span>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item">
Home
</a>
<a class="navbar-item">
Forum
</a>
<a class="navbar-item">
Spiele
</a>
<div class="navbar-item has-dropdown is-hoverable is-arrowless">
<div class="navbar-link">
<img class="nav-profilepic" src="https://static.wixstatic.com/media/1bfda4_6f8ae00a346644a89245f331fc6c6b8e~mv2_d_3476_5214_s_4_2.jpeg?dn=">
Tränenreich
</div>
<div class="navbar-dropdown">
<a class="navbar-item">
Profil
</a>
<a class="navbar-item">
Nachrichten
</a>
<a class="navbar-item">
Rangliste
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Hilfe
</a>
<a class="navbar-item">
Einstellungen
</a>
<a class="navbar-item">
Mod-Forum
</a>
</div>
</div>
</div>
</div>
</div>
</header>
I am trying to get this images on the same line but the images bump.
This is the code:
HTML
<div class="first-list">
<ul>
<li><a style="text-decoration:none;" href="http://trendwatching.com/freepublications/?utm_campaign=2016%20Global%20Consumer%20Trend%20Events&utm_content=Footer-FP&utm_source=email" target="_blank">
<img src="#" />TW:FREE
</a>
</li>
<li><a style="text-decoration:none;" href="http://spotters.trendwatching.com/?utm_campaign=2016%20Global%20Consumer%20Trend%20Events&utm_content=Footer-TW%3AIN&utm_source=email" target="_blank">
<img src="#" />TW:IN
<a/>
</li>
<li><a style="text-decoration:none;" href="http://trendwatching.com/about/" target="_blank">
<img src="#" />TW:ABOUT
</a>
</li>
</ul>
</div>
In order to get the images on one line, use css property display: inline, it will align your items in single line
I got you solution, added float=left in li elements, just increase width in css in case they are not fitting:
<div class="first-list">
<ul>
<li style="float:left;list-style-type: none;">
<a style="text-decoration:none;" href="http://trendwatching.com/freepublications/?utm_campaign=2016%20Global%20Consumer%20Trend%20Events&utm_content=Footer-FP&utm_source=email" target="_blank">
<img src="#" />TW:FREE
</a>
</li>
<li style="float:left;list-style-type: none;">
<a style="text-decoration:none;" href="http://spotters.trendwatching.com/?utm_campaign=2016%20Global%20Consumer%20Trend%20Events&utm_content=Footer-TW%3AIN&utm_source=email" target="_blank">
<img src="#" />TW:IN
</a>
</li>
<li style="float:left;list-style-type: none;"><a style="text-decoration:none;" href="http://trendwatching.com/about" target="_blank">
<img src="#" />TW:ABOUT
</a>
</li>
</ul>
</div>
<style>
div{
width:1080px;
}
</style>
I'm trying to put a linkable image into my header RIGHT underneath the phone number but its not working. My question is where do I place the div and how do I style it?
The code for me current header is:
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
<?php bloginfo( 'description' ); ?><br />
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
info<br />
<div>an image</div>
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>
Below is my HTML code for a nav with sub lists. The sub lists drop downwards and I want them to open upwards as the nav is located at the bottom part of the page, how can I do this?
I have set up a fiddle here http://jsfiddle.net/rabelais/b58Yj/1/
<ul id="nav">
<li>
<a id="lfw-link" href="london-fashion-week.html">
Live at London Fashion Week
</a>
<nav id="lfw-nav">
<a href="london-fashion-week.html">
SEE ALL
</a>
<a href="lee-roach.html">
Lee Roach
</a> Xander Zhou
<a href="vivienne-westwood-2013.html">
Vivienne Westwood 2013
</a>
<a href="paul-smith.html">
Paul smith
</a>
<a href="house-of-holland.html">
House of Holland
</a>
<a href="roksanda.html">
Roksanda
</a>
<a href="julien-mcdonald.html">
Julien Mcdonald
</a>
<a href="vivienne-westwood-2012.html">
Vivienne Westwood 2012
</a>
<a href="2012-lfw.html">
London Fashion Week 2012
</a>
</nav>
</li>
<li>
<a id="clients-link" href="clients.html">
Clients
</a>
<nav id="clients-nav">
<a href="clients.html">
SEE ALL
</a>
<a href="yoga-project.html">
Yoga Project
</a>
<a href="edward-sharpe.html">
Edward Sharpe and the magnetic zeros
</a>
<a href="tank-magazine.html">
Tank Magazine
</a>
<a href="volt-magazine.html">
Volt Magazine
</a>
<a href="poplin.html">
Poplin
</a>
<a href="dash-magazine.html">
Dash Magazine
</a>
<a href="tank-o-magazine.html">
O Tank Magazine
</a>
<a href="grit-magazine.html">
Grit Magazine
</a>
<a href="gieves-and-hawkes.html">
Gieves and Hawkes
</a>
</nav>
</li>
<li>
<a id="personal-link" href="personal.html">
Personal Projects
</a>
<nav id="personal-nav">
<a href="personal.html">
SEE ALL
</a>
<a href="other-drawings.html">
Other Drawings
</a>
<a href="head-in-the-clouds.html">
Head in the Clouds
</a>
<a href="restless.html">
Restless
</a>
<a href="acne-sample-lookbook.html">
Acne Sample LookBook
</a>
<a href="men-interupted.html">
Men Interupted
</a>
</nav>
</li>
<li>
<a id="video-link" href="tank-magazine-stop-motion.html">
Video
</a>
<nav id="video-nav">
<a href="tank-magazine-stop-motion.html">
Tao Lin Interview Tank Magazine
</a>
</nav>
</li>
<li>
<a href="about.html">
About
</a>
</li>
<li>
<a href="contact.html">
Contact
</a>
</li>
Add
position:absolute;
bottom:18px;
left:0;
to #nav>li:hover>nav
JSFiddle Demo
So that the sub-menu opens from the bottom -> upwards
you can check this jsfiddle over here, examine the code and you'll get what you need
jsfiddle
#nav:hover ul li:hover ul {
position: absolute;
margin-top: 1px;
font: 10px;
bottom: 100%;
}