I would like to create a dropdown menu that displays an image in the second dropdown. I have written the CSS code as it should be written, and I think there is no problem with the structure of my HTML code as well. So, after hovering on Afyon White list item, there should be displayed an image(position is not adjusted yet) but it does not. Any suggestions?
/* regardless */
li {
list-style: none;
text-transform: uppercase;
}
/* theme.scss */
.MegaMenu__Inner {
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-wrap: nowrap;
flex-direction: column;
margin: 0 auto;
padding: 0 10px;
}
#media screen and (min-width: 1240px) {
.MegaMenu__Inner {
max-width: 1280px;
margin-left: auto;
margin-right: auto;
}
}
/* sca-jqueryblabla.scss */
.MegaMenu__Item {
display: inline-block;
position: relative;
width: 5rem;
transition: all 0.9s ease-in-out;
}
.MegaMenu__Item > .MegaMenu__Title {
display: inline-block;
}
.MegaMenu__Item > .MegaMenu__Title:hover {
transition: all 0.9s ease-in-out;
}
.MegaMenu__Title--dropdown {
display: none;
position: absolute;
z-index: 1;
width: 100%;
margin-top: -1.5rem;
margin-left: 4rem;
width: 100%;
transition: all 0.9s ease-in-out;
}
.DropdownList--li {
width: 9rem;
padding: 0.4rem;
}
.MegaMenu__Title--dropdown .DropdownList {
display: block;
position: relative;
}
.MegaMenu__Item:hover .MegaMenu__Title--dropdown {
display: block;
transition: all 9s ease-in-out;
}
.MegaMenu__Item.MegaMenu__Item--fit {
cursor: pointer;
padding: 0.5rem;
text-align: center;
background-color: white;
}
.MegaMenu__Item.MegaMenu__Item--fit a {
text-decoration: none;
color: #5c5c5c;
}
.MegaMenu__Item {
position: relative;
}
.Linklist {
position: absolute;
}
.DropdownList {
position: relative;
display: inline-block;
}
.color-nav {
display: none;
position: absolute;
width: 10rem;
height: 10rem;
border: 3px solid black;
}
.DropdownList--li:hover .color-nav {
display: inline-block;
}
<div class="MegaMenu__Item MegaMenu__Item--fit">
<a href="" class="MegaMenu__Title Heading Text--subdued u-h7"
>White</a>
<div class="MegaMenu__Title--dropdown">
<ul class="DropdownList DropdownList_White">
<li class="DropdownList--li DropdownList_White--li">
<a>Afyon White</a>
</li>
<div class="color-nav">
<img src="" alt="">
</div>
</ul>
</div>
</div>
The following <div>:
<div class="color-nav">
<img src="" alt="">
</div>
should be inside the <li> that has the class DropdownList--li DropdownList_White--li in order to be able to be selected as per your CSS which is:
.DropdownList--li:hover .color-nav {
display: inline-block;
}
That is, above, you are selecting .color-nav as a child of .DropdownList--li, but in your HTML the .color-nav is not its child.
Related
I am trying to create navbar with image logo, Title, Navigation Links and some social links also. I have created 4 divs for each. Whenever I decrease the screen width using responsive a white color appears in the nav bar and increases to the left as i decrease the screen width.
Here are some pics also:
You can aslo see width on top of the picture
Here the problem as i decreases the screen width
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#font-face {
font-family: PollerOne;
src: url('../../fonts/Poller_One/PollerOne-Regular.ttf');
}
/* Styling Navigation Bar */
#navbar {
display: flex;
position: relative;
align-items: center;
height: 65px;
width: 100%;
}
#navbar::before {
content: "";
position: absolute;
background-color: #262626;
height: 65px;
width: 100%;
z-index: -2;
}
.navbar {
color: white;
margin: 7px 7px;
}
/* Styling Logo */
#logo {
background-color: black;
height: 45px;
width: 45px;
min-width: 45px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
#logo img {
filter: invert();
width: 25px;
}
/* Styling Title */
#title {
font-family: PollerOne;
min-width: 160.5px;
font-size: 1.4rem;
margin-left: 0px;
}
/* Styling Nav links */
#nav-links {
margin: 0 auto;
}
#nav-links ul {
list-style-type: none;
display: flex;
}
.nav-links {
font-size: 20px;
margin: 0 20px;
/* padding: 5px 10px; */
position: relative;
cursor: pointer;
}
/* Animation Under Nav Links */
.nav-links::after {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: -4px;
background: linear-gradient(white 0 0) center/0% 100% no-repeat;
display: block;
}
:hover.nav-links::after {
animation: pulse 300ms linear;
animation-fill-mode: forwards;
}
#keyframes pulse {
to {
background-size: 100% 100%;
}
}
/* Styling Social Links */
#social-links {
margin-left: auto;
display: flex;
}
.social-links {
width: 30px;
height: 30px;
border-radius: 11px;
display: flex;
align-items: center;
justify-content: center;
margin: 0 5px;
}
.social-links img {
width: 27px;
transition: all 200ms ease;
}
.social-links img:hover {
transform: scale(1.5)
}
/* Utility Class */
<div id="navbar">
<div id="logo" class="navbar">
<img src="./img/bag.png" alt="">
</div>
<div id="title" class="navbar">Meals Point</div>
<div id="nav-links" class="navbar">
<ul>
<li class="nav-links"><a id="link-1">Home</a></li>
<li class="nav-links"><a id="link-2">About</a></li>
<li class="nav-links"><a id="link-3">Services</a></li>
<li class="nav-links"><a id="link-4">Recipes</a></li>
<li class="nav-links"><a id="link-5">Contact</a></li>
</ul>
</div>
<div id="social-links" class="navbar">
<a class="social-links" href="https://www.twitter.com"><img src="./img/twitter.png" id="link-1"></a>
<a class="social-links" href="https://www.facebook.com"><img src="./img/facebook.png" id="link-2"></a>
<a class="social-links" href="https://www.instagram.com"><img src="./img/instagram.png" id="link-3"></a>
</div>
</div>
Try to add to #navbar float: left; :
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#font-face {
font-family: PollerOne;
src: url('../../fonts/Poller_One/PollerOne-Regular.ttf');
}
/* Styling Navigation Bar */
#navbar {
display: flex;
position: relative;
align-items: center;
height: 65px;
min-width: 100%;
float: left;
}
#navbar::before {
content: "";
position: absolute;
background-color: #262626;
height: 65px;
min-width: 100%;
z-index: -2;
}
.navbar {
color: white;
margin: 7px 7px;
}
/* Styling Logo */
#logo {
background-color: black;
height: 45px;
width: 45px;
min-width: 45px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
#logo img {
filter: invert();
width: 25px;
}
/* Styling Title */
#title {
font-family: PollerOne;
min-width: 160.5px;
font-size: 1.4rem;
margin-left: 0px;
}
/* Styling Nav links */
#nav-links {
margin: 0 auto;
}
#nav-links ul {
list-style-type: none;
display: flex;
}
.nav-links {
font-size: 20px;
margin: 0 20px;
/* padding: 5px 10px; */
position: relative;
cursor: pointer;
}
/* Animation Under Nav Links */
.nav-links::after {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: -4px;
background: linear-gradient(white 0 0) center/0% 100% no-repeat;
display: block;
}
:hover.nav-links::after {
animation: pulse 300ms linear;
animation-fill-mode: forwards;
}
#keyframes pulse {
to {
background-size: 100% 100%;
}
}
/* Styling Social Links */
#social-links {
margin-left: auto;
display: flex;
}
.social-links {
width: 30px;
height: 30px;
border-radius: 11px;
display: flex;
align-items: center;
justify-content: center;
margin: 0 5px;
}
.social-links img {
width: 27px;
transition: all 200ms ease;
}
.social-links img:hover {
transform: scale(1.5)
}
/* Utility Class */
<div id="navbar">
<div id="logo" class="navbar">
<img src="./img/bag.png" alt="">
</div>
<div id="title" class="navbar">Meals Point</div>
<div id="nav-links" class="navbar">
<ul>
<li class="nav-links"><a id="link-1">Home</a></li>
<li class="nav-links"><a id="link-2">About</a></li>
<li class="nav-links"><a id="link-3">Services</a></li>
<li class="nav-links"><a id="link-4">Recipes</a></li>
<li class="nav-links"><a id="link-5">Contact</a></li>
</ul>
</div>
<div id="social-links" class="navbar">
<a class="social-links" href="https://www.twitter.com"><img src="./img/twitter.png" id="link-1"></a>
<a class="social-links" href="https://www.facebook.com"><img src="./img/facebook.png" id="link-2"></a>
<a class="social-links" href="https://www.instagram.com"><img src="./img/instagram.png" id="link-3"></a>
</div>
</div>
Try to add
For Left Align:class = "navbar-nav mr-auto"
For Right Align:class = "navbar-nav ml-auto"
For Center Align:class = "navbar-nav mx-auto"
When the screen width becomes less than 767, the menu turns into a burger and on IE it looks different.
The alignment of items with flex disappears (the burger button and the basket are pressed), I sin on the menu that is positioned with
using fixed (becomes fixed at the checkpoint), I think that on IE the menu still takes its
the place, because of which the alignment occurs with its consideration. If you comment out the menu, everything will be ok.
How to fix it?
enter image description here
header in static condition
enter image description here
<div class="header_body">
<a href="#">
<h1>ze<span>bra</span></h1>
</a>
<div class="wrap-align">
<nav class="header_menu">
<ul class="header_list">
<li>Home</li>
<li>Products</li>
<li>Shopping</li>
<li>Contact</li>
</ul>
</nav>
<div class="price">
<a href="#">
<img src="img/Shape1.png" alt="">
</a>
<span>$35.00</span>
<span>▼</span>
</div>
<div class="header_burger">
<span></span>
</div>
</div>
</div>
//css
.header_body {
position: relative;
display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
justify-content: space-between;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
height: 86px;
align-items: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
> a {
text-decoration: none;
color: $colorWord_header;
position: relative;
z-index: 5;
display: inline-block;
margin-right: 40px;
}
a > h1 {
font-size: 38px;
font-family: "HelveticaNeueCyr-Bold";
text-transform: uppercase;
}
a > h1 > span {
color: $logo_color;
}
}
.wrap-align {
width: 650px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header_burger {
display: none;
}
.header_menu {
// margin-right: 118px;
}
.header_list {
display: flex;
position: relative;
z-index: 2;
li {
list-style: none;
}
a {
text-decoration: none;
display: inline-block;
color: $colorWord_header;
font-size: 18px;
font-family: "HelveticaNeueCyr-Regular";
padding: 34px 15px;
transition: all 0.3s;
&:hover {
color: #fff;
background-color: $bgc_head;
}
}
}
.price {
position: relative;
z-index: 5;
a {
text-decoration: none;
}
img {
vertical-align: baseline;
}
a + span {
font-size: 24px;
font-family: "HelveticaNeueCyr-Regular";
color: rgb(157, 157, 157);
margin: 0 10px;
}
span + span {
font-size: 18px;
color: rgb(157, 157, 157);
vertical-align: super;
cursor: pointer;
}
}
//#media
.header {
.header_burger {
display: block;
position: relative;
width: 30px;
height: 20px;
position: relative;
z-index: 3;
}
.header_burger:before,
.header_burger:after {
content: "";
position: absolute;
background-color: black;
width: 100%;
height: 2px;
left: 0;
transition: all 0.3s;
}
.header_burger:before {
top: 0;
}
.header_burger:after {
bottom: 0;
}
.header_burger span {
position: absolute;
top: 9px;
left: 0;
background-color: black;
width: 100%;
height: 2px;
transition: all 0.3s;
}
.header_burger.active span {
transform: scale(0);
}
.header_burger.active:before {
transform: rotate(45deg);
top: 9px;
}
.header_burger.active:after {
transform: rotate(-45deg);
bottom: 9px;
}
.header_menu {
position: fixed;
top: -100%;
left: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(255, 255, 255, 0.941);
padding: 130px 0 0 0;
transition: all 0.4s;
z-index: 1;
}
.wrap-align {
width: 300px;
}
.header_menu.active {
top: 0;
}
.header_list {
margin: 0 0 0 20px;
display: block;
li {
// margin: 10px 0;
}
a {
padding: 10px 20px;
}
}
.price {
margin-right: -30%;
}
}
I'm currently trying to build my first website (homework). For my dropdown menu, I used Dev Ed's tutorial for a dropdown menu, and it is working except that I can't click on the links in the dropdown bits.
(the mouse coursor still changes into that hand-symbol though)
How can I fix this?
nav {
grid-column: 1/5;
background: #2E3045;
justify-content: center;
border-radius: 10px;
}
nav a,
button {
text-decoration: none;
font-size: 1.7vw;
font-family: Bahnschrift, sans-serif;
color: #DFB830;
font-weight: bold;
}
/* horizontal-menu */
.menu {
height: auto;
display: flex;
justify-content: space-around;
align-items: center;
}
/* styling horizontal-menu buttons */
.dropdown button,
.dd-buttons {
background: none;
border: none;
cursor: pointer;
text-transform: uppercase;
padding-top: 1%;
padding-bottom: 1%;
}
.menu button:hover,
.dd-buttons:hover {
color: #ECEEFF;
}
/* styling the dropdown arrow */
#media only screen and (max-width: 480px) {
.menu img {
max-width: 7px;
height: auto;
display: inline-block;
}
}
#media only screen and (min-width: 481px) {
.menu img {
max-width: 15px;
height: auto;
display: inline-block;
}
}
/* dropdown list */
.dropdown {
position: relative;
}
.dropdown ul {
position: absolute;
background: #DFB830;
margin-top: 8px;
min-width: 150%;
display: flex;
justify-content: space-around;
align-items: center;
flex-direction: column;
list-style: none;
border-radius: 5px;
opacity: 0;
pointer-events: none;
transition: all 0.4s ease;
transform: translateY(10px);
}
/* styling dropdown menu list items */
.dropdown li {
width: 100%;
height: 100%;
line-height: 250%;
display: flex;
justify-content: center;
align-items: center;
transition: all 0.4s ease;
}
.dropdown a {
font-size: 1.5vw;
color: #2E3045;
}
/* when hovering over dropdown list */
.dropdown li:hover {
background-color: #E9CF72;
}
.dropdown button:focus+ul {
opacity: 1;
pointer-events: all;
transform: translateY(0px);
}
<!------------------------ menu ------------------------>
<nav>
<div class="menu">
<button class="dd-buttons">YouthDuo</button>
<button class="dd-buttons">Galactic Spirit</button>
<div class="dropdown">
<button>Feng Shui <img src="images/dropdown icon.png"></button>
<ul>
<li>Feng Shui Basics</li>
<li>CD's and DVD's</li>
<li>Books and EBooks</li>
</ul>
</div>
<div class="dropdown">
<button>Color Alchemy <img src="images/dropdown icon.png"></button>
<ul>
<li>Living in Color</li>
<li>Guided Training</li>
<li>Jami Lin's Products</li>
</ul>
</div>
</div>
</nav>
remove the pointer-events:none
.dropdown ul {
position: absolute;
background: #DFB830;
margin-top: 8px;
min-width: 150%;
display: flex;
justify-content: space-around;
align-items: center;
flex-direction: column;
list-style: none;
border-radius: 5px;
opacity: 0;
transition: all 0.4s ease;
transform: translateY(10px);
}
body {
padding: 0;
margin: 0;
font-family: 'Roboto', sans-serif;
font-size: 16px;
box-sizing: border-box !important;
}
a {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
text-decoration: none;
color: inherit;
}
a:hover,
a:link,
a:active {
text-decoration: none;
}
h1, h2, h3, h4, h5, h6, p {
margin: 0;
}
.container {
width: 100%;
height: 100%;
min-height: 100vh;
position: relative;
}
.main-content {
max-width: 800px;
margin: 0 auto;
padding: 50px 100px;
transition: transform .3s ease;
}
.header {
width: 100%;
height: 56px;
background: black;
}
.header-container {
height: 100%;
padding: 0 40px;
margin: 0 auto;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
position: relative;
}
.bottom, .right {
position: fixed;
background: black;
}
.right {
top: 0; bottom: 0;
width: 56px;
right: 0;
}
.bottom {
left: 0; right: 0;
height: 3.5vh;
bottom: 0;
}
.logo {
width: 10%;
}
.nav-bar {
display: flex;
flex-direction: row;
width: 90%;
align-items: center;
align-self: stretch;
}
#media screen and (max-width: 600px) {
.nav-bar {
position: absolute;
top: 56px;
left: 0;
width: 100%;
height: 0;
overflow: hidden;
background-color: black;
flex-direction: column;
justify-content: flex-start;
align-items: center;
z-index: 8888;
transition: height .3s .1s ease;
}
}
.nav-list {
list-style: none;
padding: 100px;
margin: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
}
#media screen and (max-width: 600px) {
.nav-list {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: space-evenly;
height: 80%;
/*
Initially list will be hidden and will reappear once the
nav-bar is opened
*/
visibility: hidden;
opacity: 0;
transition: visibility .2s ease, opacity .2s ease;
}
}
.nav-list-item {
align-self: stretch;
display: flex;
align-items: center;
justify-content: center;
position: relative;
right: 75.5vw;
left: -23.5vw;
transition: color .3s ease;
color: #989797;
}
.nav-list-item:not(:last-child) {
margin-right: 99px;
}
#media screen and (max-width: 600px) {
a {
justify-content: flex-start;
}
.nav-list-item {
margin: 0px auto 0px auto !important;
border-bottom: 1px solid #989797;
width: 80%;
justify-content: left;
padding: 15px 0;
}
}
.sub-list-container {
overflow: hidden;
position: absolute;
top: 56px;
left: 10%;
transform: translateX(-50%);
/* If we need show/hide feature */
height: inherit;
visibility: hidden;
opacity: 0;
transition: all .3s ease;
}
#media screen and (max-width: 600px) {
.sub-list-container {
display: none;
}
}
.sub-list {
width: 200px;
margin: 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: column;
align-items: center;
background: black;
}
.sub-item {
color: #989797;
font-size: 16px;
padding: 10px;
position: relative;
align-self: stretch;
text-align: center;
z-index: 2;
transition: color .3s ease;
}
.sub-item:hover {
color: white;
}
.sub-item::before {
z-index: 1;
}
.nav-list-item:hover {
cursor: pointer;
color: white;
}
.nav-list-item:hover .sub-list-container {
/* For show/hide feature */
visibility: visible;
opacity: 1;
}
.toggle-nav {
display: none;
}
.toggle-nav-off {
display: none;
}
#media screen and (max-width: 600px) {
.toggle-nav {
display: block;
}
.toggle-nav-off {
display: block;
background: white;
border-radius: 50%;
height: 30px;
width: 30px;
}
:target {
/* Defining the height of the shutter effect */
height: calc(100vh - 56px);
}
:target .nav-list {
visibility: visible;
opacity: 1;
transition: visibility .2s .2s ease, opacity .2s .2s ease;
}
}
/* Code for the side-bar starts here */
.side-bar {
position: absolute;
top: 56px;
left: 0;
width: 60px;
/* Initial width according to size of image */
height: calc(100% - 56px);
background: black;
color: white;
overflow: hidden;
/* Imp to give as the List is having width larger than the initial width of the side-bar */
transition: all .3s ease;
}
.side-bar {
width: 8vw;
}
.side-bar-left {
position: absolute;
top: 56px;
right: 10px;
width: 60px;
/* Initial width according to size of image */
height: calc(100% - 56px);
background: black;
color: white;
overflow: hidden;
/* Imp to give as the List is having width larger than the initial width of the side-bar */
transition: all .3s ease;
width: 250px;
}
.item-list {
list-style: none;
width: 250px;
left: -3.2vw;
display: flex;
flex-direction: column;
position: relative;
z-index: 10;
}
.item {
display: flex;
justify-content: flex-start;
align-items: center;
align-self: stretch;
padding: 3.85vh .3vw;
transition: all .5s ease;
position: relative;
color: #989797;
}
.item:not(:last-child) {
margin-bottom: 5px;
}
.item:hover {
color: white;
cursor: pointer;
}
.item-img {
margin-right: 10px;
width: 10px;
height: 5px;
padding: 0 10px;
transition: all .3s ease;
}
.item #dribble, .item #behance, .item #flickr {
width: 3.5vw;
height: 7vh;
}
.item #instagram {
width: 3vw;
height: 6vh;
margin-left: .5vw;
}
.item #etsy {
width: 6vw;
height: 7vh;
margin-left: -2.1vw;
}
.item #behance {
margin-left: .3vw;
}
.item #flickr{
margin-left: -.5vw;
}
.item #dribble {
margin-left: .2vw;
}
.item #pinterest {
width: 3.5vw;
height: 7vh;
margin-left: .4vw;
}
/* Code for the HOVER effect on the list items */
.item::before {
transform: scaleY(0);
width: 3px;
transition: transform .2s ease, width .3s .2s ease;
}
.sub-item::before {
width: 0px;
transition: transform .1s ease, width .2s .1s ease;
}
.item::before,
.sub-item::before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
background: linear-gradient(to bottom right, #ff506e, black);
z-index: -1;
}
.item:hover::before {
transform: scaleY(1);
}
.item:hover::before,
.sub-item:hover::before {
width: 100%;
}
.active {
color: #989797;
/* background: linear-gradient(to bottom right, #ff506e, black); THIS MAKES THE FIRST BUTTON ALWAYS RED AND HIGHLIGHTED, WHICH WE DON'T WANT */
}
.nav-active {
color: 989797;
}
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: hsl(200deg, 50%, 92%);
z-index: 9999;
visibility: hidden;
opacity: 0;
transition: all .3s ease;
}
.modal-item {
position: absolute;
width: 500px;
height: 350px;
background: url("https://37.media.tumblr.com/53fc4e7e4096cba63c0133167a4b6168/tumblr_n33ukkyWLN1rwhqloo1_500.gif");
background-position: center;
background-repeat: no-repeat;
border-radius: 2px;
padding: 10px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0);
transition: transform .3s ease;
}
.toggle-modal {
position: absolute;
top: 2vh;
left: 1.4vw;
}
/* Opening modal using CSS */
:target {
visibility: visible;
opacity: 1;
}
:target .modal-item {
transform: translate(-50%, -50%) scale(1);
}
/* .container {
display: grid;
height: 100%;
overflow: auto;
background: white;
} */
.iframe {
position: relative;
margin-left: -41.98vw;
top:52.09vh;
height: 92.322vh;
width: 90vw;
border: black;
}
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>"Users folio"</title>
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<header class="header">
<div class="header-container">
<div class="logo">
<!-- COMPANY LOGO GOES HERE -->
</div>
<nav class="nav-bar" id="nav">
<ul class="nav-list">
<li class="nav-list-item nav-active">Home</li>
<li class="nav-list-item">
About
<div class="sub-list-container">
<ul class="sub-list">
<li class="sub-item">About Our Company</li>
<li class="sub-item">Our Mission</li>
<li class="sub-item">Happy Clients</li>
<li class="sub-item">Team</li>
</ul>
</div>
</li>
<li class="nav-list-item">
Instructions
</li>
</ul>
<div class="toggle-nav-off">
<img src="https://icon-icons.com/icons2/1157/PNG/512/1487086345-cross_81577.png" alt="Close Icon" width="30" height="30">
</div>
</nav>
<div class="toggle-nav">
<img src="https://cdn2.iconfinder.com/data/icons/menu-elements/154/menu-round-512.png" alt="Close Icon" width="30" height="30">
</div>
<div class="container">
<!--
Currently just researching which sites are able to have their x-options
bypassed in order to allow viewing within an iframe, so disregard the iframe source.
-->
<iframe class="iframe" name="change-website" src="https://www.etsy.com"></iframe>
</div>
</header>
<div class="side-bar">
<ul class="item-list">
<li class="item active"><img id="behance" src="images/behance.png" width="50" height="50" class="item-img" />Behance</li>
<li class="item"><img id="dribble" src="images/dribble3.png" width="50" height="50" class="item-img" />Dribble</li>
<li class="item"><img id="etsy" src="images/etsy11.png" width="50" height="50" class="item-img"/>Etsy</li>
<li class="item"><img id="flickr" src="images/flick2.png" width="50" height="50" class="item-img" />Flickr</li>
<li class="item"><img id="instagram" src="images/Instagram_AppIcon_Aug2017.png" width="50" height="50" class="item-img" />Instagram</li>
<li class="item"><img id="pinterest" src="images/pinterest3.png" width="50" height="50" class="item-img" />Pinterest</li>
<!-- <li class="item"><img id="flickr" src="images/twitch3.png" width="50" height="50" class="item-img"/>Twitch</li> -->
</ul>
</div>
<div class="left-side-bar">
<p></p>
</div>
<div class="main-content">
<div class="modal" id="modal-item">
<div class="modal-item">
<div class="toggle-modal">
<img src="https://icon-icons.com/icons2/1157/PNG/512/1487086345-cross_81577.png" alt="Close Icon" width="30" height="30">
</div>
</div>
</div>
</div>
<div class="bottom"></div>
<div class="right"></div>
</div>
<link rel="stylesheet" href="scripts.js">
</body>
</html>
So I know that I need to use media queries to properly scale and put the code into different media queries for each max width ect.
Here is the code I have been working with, but when I change the size, even when I have tried to put them into different media queries and code them to that scale when I change the browser size, I still get issues where things like my iframe and the top menu bar moving and not being in the correct place.
I am still pretty new to frontend but I was just curious what I may be able to do to fix this?
When the browser resizes, everything should stay in its correct place.
The Home, About and Instructions should be starting from above the iframe and slightly past the top left of the iframe
Well, taking a look at your code, it's seen that you missed a meta tag to make your website resizable, add it on your head tag
<meta name="viewport" content="width=device-width, initial-scale=1">
This should fix your issue.
I simply want the :before (underline) of my anchor to change its height every time it is hovered over, but it's not working.
I hope someone could help me. Thanks in advance.
.wrapper {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
a {
display: inline-block;
text-decoration: none;
font: 4em Arial;
color: #21a1e1;
font-weight: 300;
position: relative;
}
a:before {
content: '';
position: absolute;
display: block;
width: 100%;
height: 2px;
bottom: 0;
background: #21a1e1;
transition: all .3s ease-in-out;
}
/* not working */
a:hover a:before {
height: 4px;
}
<div class="wrapper">
Hover
</div>
use a:hover::before instead of a:hover a:before I'm added the working snippet below.
.wrapper {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
a {
display: inline-block;
text-decoration: none;
font: 4em Arial;
color: #21a1e1;
font-weight: 300;
position: relative;
}
a:before {
content: '';
position: absolute;
display: block;
width: 100%;
height: 2px;
bottom: 0;
background: #21a1e1;
transition: all .3s ease-in-out;
}
/* not working */
a:hover::before {
height: 4px;
}
<div class="wrapper">
Hover
</div>