How to display the contents of drop up menu? - html

When I hover my cursor on 'English' menu, it displays the contents of 'More Behance' menu.
Image
As you can see in the Image above, the arrow for 'English' menu points upwards but displays the contents of 'More Behance' menu. Can anyone help me out by using HTML and CSS languages only.
I tried solving this problem using the code given below.
The HTML code:
<div class="dropup">
<div>
<div class="arrow-down"></div>
<button class="dropbtn1">More Behance</button>
</div>
<ul class="dropup-content" style="width: 195px; left: 20px; bottom: 30px;">
<li>Careers at Behance</li>
<li>Adobe Portfolio</li>
<li>Blog</li>
<li>Creative Career Tips</li>
<li>Download the App</li>
</ul>
</div>
<div class="dropup">
<div>
<div class="arrow-down1"></div>
<button class="dropbtn2">English</button>
</div>
<ul class="dropup-content" style="width: 100px; left: 40px; bottom: 30px;">
<li>English</li>
<li>Čeština</li>
<li>Dansk</li>
<li>Deutsch</li>
<li>Español</li>
<li>Français</li>
<li>Italiano</li>
<li>Nederlands</li>
<li>Norsk</li>
<li>Polski</li>
<li>Português</li>
<li>Pусский</li>
<li>Suomi</li>
<li>Svenska</li>
<li>Türkçe</li>
<li>日本語</li>
<li>한국어</li>
<li>中文(简体)</li>
<li>中文(繁體)</li>
</ul>
</div>
The CSS Code:
.arrow-down {
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid dimgray;
position: relative;
left: 198px;
bottom: -13px;
}
.arrow-down:hover{
transform: rotateZ(-180deg);
}
.arrow-down1 {
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid dimgray;
position: relative;
left: 18px;
bottom: -13px;
}
.arrow-down1:hover {
transform: rotateZ(-180deg);
}
.dropbtn1{
padding: 5px;
border: none;
font-family: inherit;
font-size: 11px;
font-weight: bold;
color: dimgray;
font-weight: bold;
margin-bottom: 0;
margin-top: -7.5px;
cursor: pointer;
position: relative;
left: 20px;
top: 2px;
text-align: center;
}
.dropbtn2{
padding: 5px;
border: none;
font-family: inherit;
font-size: 11px;
font-weight: bold;
color: dimgray;
font-weight: bold;
margin-bottom: 0;
margin-top: -7.5px;
cursor: pointer;
position: relative;
left: 63px;
top: 2px;
text-align: center;
}
.dropup{
position: relative;
display: inline-block;
}
.dropup-content{
display: none;
position: absolute;
/* left: 20px;
bottom: 25px; */
background-color: #f1f1f1;
width: 195px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 100;
border-radius: 10px;
font-weight: bold;
font-size: 11px;
padding-right: 7px;
color: dimgray;
/* transition: 0.3s color; */
}
.dropup-content a{
color: #000;
padding: 6px 16px;
text-decoration: none;
display: block;
}
.dropup-content a:hover{
background-color: #0057ff;
color: white;
}
.dropup:hover .dropup-content{
display: block;
}

This was basically a styling issue. Elements were overlapping each other.
Apart from the original issue you have used so many css classes, which you could replace using generic classes.
e.g : defining classes like arrow1,2 , dropdown1,2 cannot scale up easily
See the corrected HTML and anhanced css.
<div class="dropup">
<div>
<div class="arrow-down"></div>
<button class="dropbtn1">More Behance</button>
</div>
<ul id="menu1" class="dropup-content" style="width: 195px; left: 20px; bottom: 30px;">
<li>Careers at Behance</li>
<li>Adobe Portfolio</li>
<li>Blog</li>
<li>Creative Career Tips</li>
<li>Download the App</li>
</ul>
</div>
<div class="dropup">
<div>
<div class="arrow-down"></div>
<button class="dropbtn">English</button>
</div>
<ul id="menu2" class="dropup-content" style="width: 100px; left: 40px; bottom: 30px;">
<li>English</li>
<li>Čeština</li>
<li>Dansk</li>
<li>Deutsch</li>
<li>Español</li>
<li>Français</li>
<li>Italiano</li>
<li>Nederlands</li>
<li>Norsk</li>
<li>Polski</li>
<li>Português</li>
<li>Pусский</li>
<li>Suomi</li>
<li>Svenska</li>
<li>Türkçe</li>
<li>日本語</li>
<li>한국어</li>
<li>中文(简体)</li>
<li>中文(繁體)</li>
</ul>
</div>
CSS:
.more-space{height : 200px;}
.arrow-down{
float : right;
}
.arrow-down:before{
font-size : 9px;
content: "\25bc";
}
.arrow-down:hover{
transform: rotateZ(-180deg);
}
.dropup{
margin : 2px 5px;
position : relative;
float : left;
}
.dropup-content{
display: none;
position: absolute;
/* left: 20px;
bottom: 25px; */
background-color: #f1f1f1;
width: 195px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 100;
border-radius: 10px;
font-weight: bold;
font-size: 11px;
padding-right: 7px;
color: dimgray;
/* transition: 0.3s color; */
}
.dropup-content a{
color: #000;
padding: 6px 16px;
text-decoration: none;
display: block;
}
.dropup-content a:hover{
background-color: #0057ff;
color: white;
}
.dropup:hover .dropup-content{
display: block;
}
Working Fiddle : https://jsfiddle.net/svamoy9j/

Related

Achieving vertical structure from horizontally placed divs

I have a list of div elements that act as buttons. They have hover functionality from its CSS. I am placing them all in horizontal line. But I want them to be placed vertically that is one after another in the same line. I am not sure how I can do it since the width attribute places it in the same line.
How do I place them as new line function with certain equal distance?
body {
margin: 0;
font-family: 'Roboto Condensed', sans-serif;
}
h1 {
color: #333;
font-weight: 700;
margin-top: 125px;
text-align: center;
text-transform: uppercase;
letter-spacing: 4px;
line-height: 23px;
}
/* --- Start progress bar --- */
.process-wrapper {
margin: auto;
max-width: 1080px;
}
#progress-bar-container {
position: relative;
width: 90%;
margin: auto;
height: 100px;
margin-top: 65px;
}
#progress-bar-container ul {
padding: 0;
margin: 0;
padding-top: 15px;
z-index: 9999;
position: absolute;
width: 100%;
margin-top: -40px
}
#progress-bar-container li:before {
content: " ";
display: block;
margin: auto;
width: 30px;
height: 30px;
border-radius: 50%;
border: solid 2px #aaa;
transition: all ease 0.3s;
}
#progress-bar-container li.active:before,
#progress-bar-container li:hover:before {
border: solid 2px #fff;
background: linear-gradient(to right, #1a00aa 0%, rgb(0, 81, 255) 100%);
}
#progress-bar-container li {
list-style: none;
float: left;
width: 20%;
text-align: center;
color: #aaa;
text-transform: uppercase;
font-size: 11px;
cursor: pointer;
font-weight: 700;
transition: all ease 0.2s;
vertical-align: bottom;
height: 60px;
position: relative;
}
#progress-bar-container li .step-inner {
position: absolute;
width: 100%;
bottom: 0;
font-size: 14px;
}
#progress-bar-container li.active,
#progress-bar-container li:hover {
color: #444;
}
#progress-bar-container li:after {
content: " ";
display: block;
width: 6px;
height: 6px;
background: #777;
margin: auto;
border: solid 7px #fff;
border-radius: 50%;
margin-top: 40px;
box-shadow: 0 2px 13px -1px rgba(0, 0, 0, 0.3);
transition: all ease 0.2s;
}
#progress-bar-container li:hover:after {
background: #555;
}
#progress-bar-container li.active:after {
background: #207893;
}
<div class="process-wrapper">
<div id="progress-bar-container">
<ul>
<li class="step step01 active">
<div class="step-inner">A</div>
</li>
<li class="step step02">
<div class="step-inner">B</div>
</li>
<li class="step step03">
<div class="step-inner">C</div>
</li>
<li class="step step04">
<div class="step-inner">D</div>
</li>
<li class="step step05">
<div class="step-inner">E</div>
</li>
</ul>
</div>
</div>
Just add flex and flex-direction as column to the ul tag.
#progress-bar-container ul{
display:flex;
flex-direction:column;
padding: 0;
margin: 0;
padding-top: 15px;
z-index: 9999;
position: absolute;
width: 100%;
margin-top: -40px
}
For more information just look at this link
https://css-tricks.com/snippets/css/a-guide-to-flexbox/

how to create design of Text within right arrow symbol with html and css

I want to create a simple design with the help of bootstrap, html and css the design is look like:
i have tried following code to design:
html:
<div class="container mt-5">
<div class="row">
<div class="col-3">
<ul class="list-unstyled lists">
<li>Initial Meeting</li>
<li>Pre Test</li>
<li>Application for Job</li>
<li>Legal Screening</li>
<li>Additional Processing</li>
<li>Schedule for Training</li>
</ul>
</div>
</div>
</div>
and css is:
.container{
margin-top:200px;
}
.lists{
border:1px solid #000;
}
.lists li{
background:#e1ddd3;
color:#333;
font-weight: bold;
font-family: 'Rajdhani', sans-serif;
font-stretch: normal;
font-style: normal;
line-height: 1.5;
letter-spacing: normal;
height: 40px;
position: relative;
margin:10px;
padding:10px 20px;
}
.lists li:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid #e1ddd3;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
but unable to give background line which is behind of list-items, please anyone have a look on this and suggest a solution for above.
You can use pseudo element on .lists.
.container{
margin-top:200px;
}
.lists{
/*border:1px solid #000;*/
position: relative;
}
.lists li{
background:#e1ddd3;
color:#333;
font-weight: bold;
font-family: 'Rajdhani', sans-serif;
font-stretch: normal;
font-style: normal;
line-height: 1.5;
letter-spacing: normal;
height: 40px;
position: relative;
margin:10px;
padding:10px 20px;
}
.lists li:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid #e1ddd3;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.lists::before {
content: '';
width: 80%;
height: 110%;
border: 1px solid red;
position: absolute;
top: -5%;
left: 10%;
border-radius: 10px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<div class="container mt-5">
<div class="row">
<div class="col-8">
<ul class="list-unstyled lists">
<li>Initial Meeting</li>
<li>Pre Test</li>
<li>Application for Job</li>
<li>Legal Screening</li>
<li>Additional Processing</li>
<li>Schedule for Training</li>
</ul>
</div>
</div>
</div>
Use an absolute position pseudo element :after the .lists. For example:
.lists:after {
content: "";
position: absolute;
right: 0;
bottom: 0;
top: -10px;
left: 40px;
height: 105%;
width: 75%;
display: block;
border: 1px solid #888;
border-radius: 10px;
z-index: -1;
}
Codeply

how to have opposite speech bubble in css and html with arrow

I am trying to create a speech bubble with an arrow on the left and right side. Something like below
I have used the below CSS to achieve the same :
.speech-wrapper{
padding: 30px 40px;
}
.chatbox {
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:3px;
background: #c7edfc;
color: #000;
position: relative;
border-radius: 4px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}
.chatbox_other{
padding: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top:3px;
background: #D3D3D3;
color: #000;
position: relative;
border-radius: 4px;
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}
.name_other{
font-weight: 600;
position: absolute;
font-size: 12px;
margin: 0 0 4px;
color: #3498db;
bottom: 8px;
right: 10px;
}
.timestamp_other{
font-size: 11px;
position: absolute;
text-align: left;
bottom: 0px;
left: 10px;
text-transform: uppercase; color: #999
}
.timestamp{
font-size: 11px;
position: absolute;
bottom: 8px;
right: 10px;
text-transform: uppercase; color: #999
}
/* speech bubble 13 */
.name{
font-weight: 600;
font-size: 12px;
margin: 0 0 4px;
color: #3498db;
}
.bubble-arrow {
position: absolute;
width: 0;
bottom:42px;
left: -16px;
height: 0;
&.alt{
right: -2px;
bottom: 40px;
left: auto;
}
}
.bubble-arrow:after {
content: "";
position: absolute;
border: 0 solid transparent;
border-top: 9px solid #c7edfc;
border-radius: 0 20px 0;
width: 15px;
height: 30px;
transform: rotate(145deg);
}
.bubble-arrow.alt:after {
transform: rotate(45deg) scaleY(-1);
}
But for me, the arrow is missing always it always comes with a box.
I am a beginner to HTML and CSS any help on this will be appreciated.
Am I doing anything wrong to draw the rectangle?
EDIT:
I can see the chat bubble on chrome and all recent browsers but when I try using the very old browsers the below statement does not decode correctly. So the chat triangle was not in the appropriate position.
transform: rotate(145deg);
}
.bubble-arrow.alt:after {
transform: rotate(45deg) scaleY(-1);
}
HTML CODE:
<div class="speech-wrapper"><div class="chatbox"><div class="txt"><p class="name">TestUser1</p>Hi<span class="timestamp">10:20 pm</span></div><div class="bubble-arrow alt"></div></div>
Is there anything else can I use apart from the transform
Try this,
<!doctype html>
<html>
<head>
<title>Chat Bubbles Demo</title>
<style type="text/css">
.chat-box
{
width: 300px;
}
.header
{
padding: 10px;
color: white;
font-size: 14px;
font-weight: bold;
background-color: #6d84b4;
}
.messages
{
padding: 10px;
height: 200px;
background-color: green;
background-color: rgb(237, 239, 244);
border-width: 1px;
border-color: black;
border-style: solid;
overflow-y: scroll;
}
.messages ul
{
padding: 0px;
list-style-type: none;
}
.messages ul li
{
height: auto;
margin-bottom: 10px;
clear: both;
padding-left: 10px;
padding-right: 10px;
}
.messages ul li span
{
display: inline-block;
max-width: 200px;
background-color: white;
padding: 5px;
border-radius: 4px;
position: relative;
border-width: 1px;
border-style: solid;
border-color: grey;
}
.messages ul li span.left
{
float: left;
}
.messages ul li span.left:after
{
content: "";
display: inline-block;
position: absolute;
left: -8.5px;
top: 7px;
height: 0px;
width: 0px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid white;
}
.messages ul li span.left:before
{
content: "";
display: inline-block;
position: absolute;
left: -9px;
top: 7px;
height: 0px;
width: 0px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid black;
}
.messages ul li span.right:after
{
content: "";
display: inline-block;
position: absolute;
right: -8px;
top: 6px;
height: 0px;
width: 0px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-left: 8px solid #dbedfe;
}
.messages ul li span.right:before
{
content: "";
display: inline-block;
position: absolute;
right: -9px;
top: 6px;
height: 0px;
width: 0px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-left: 8px solid black;
}
.messages ul li span.right
{
float: right;
background-color: #dbedfe;
}
.clear
{
clear: both;
}
.input-box
{
background-color: white;
height: 50px;
padding: 0px;
}
.input-box textarea
{
padding: 0px;
width: 278px;
height: 100%;
display: inline-block;
outline: 0px;
border-width: 0px;
resize: none;
border-width: 1px;
border-color: black;
border-style: solid;
font-size: 12px;
padding: 10px;
border-top-width: 0px;
}
</style>
</head>
<body>
<div class="chat-box">
<div class="header">
Narayan Prusty
</div>
<div id="messages" class="messages">
<ul>
<li>
<span class="left">Hello</span>
<div class="clear"></div>
</li>
<li>
<span class="left">Are you there?</span>
<div class="clear"></div>
</li>
<li>
<span class="right">Yes I am here</span>
<div class="clear"></div>
</li>
<li>
<span class="left">Thanks for accepting my friend request</span>
<div class="clear"></div>
</li>
<li>
<span class="right">You Welcome</span>
<div class="clear"></div>
</li>
<li>
<span class="left">Bye</span>
<div class="clear"></div>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="input-box">
<textarea placeholder="Enter message"></textarea>
</div>
</div>
</body>
</html>

How to adjust sections in html?

I am designing a simple website using html/css/javascript/bootstrap.
But i am having weird kind of problem.
I want my menu and showcase first and after that i have another section called 'about' but about section is coming at first and menu is going down as show in pic
Here is my code
home.html
<section id="home">
<div id="menu">
<a id="toggle" (click)="openMenu()">
<i *ngIf="showMenu" class="fa fa-bars menu-bar" aria-hidden="true"></i>
</a>
<a id="close-btn" (click)="closeMenu()">
<i *ngIf="!showMenu" class="fa fa-times close-btn" aria-hidden="true"></i>
</a>
<ul class="menu-items bg-white rounded" #menuItems>
<li>
Intro
</li>
<li>
About
</li>
<li>
Projects
</li>
<li>
Contact
</li>
</ul>
</div>
<div id="heading">
<div id="logo-tagline" class="container">
<p id="logo">A Webdeveloper</p>
<p id="tagline">
Hey! I`m Narayan &
<br> this is my website,
<br> feel free to have a
<br> look around.
</p>
</div>
</div>
</section>
<section id="about">
<div class="about container">
<h1 id="about-me">About</h1>
<p>
Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust
foundation for web applications and APIs. By leveraging async functions, Koa allows you to ditch callbacks and greatly
increase error- handling. Koa does not bundle any middleware within its core, and it provides an elegant suite of methods
that make writing servers fast and enjoyable.
</p>
</div>
</section>
style.scss
/* You can add global styles to this file, and also import other style files */
#import "~bootswatch/dist/lux/_variables.scss";
#import "~bootstrap/scss/bootstrap.scss";
#import "~bootswatch/dist/lux/_bootswatch.scss";
$primary-color: #F4F4F4;
$secondary-color: #FFFFFF;
body {
background-color: $primary-color;
}
//navbar
#menu {
position: fixed;
top: 35px;
right: 42px;
z-index: 50;
}
#menu a#toggle {
position: absolute;
top: 0;
right: 0;
padding: 15px;
background: transparent;
border-radius: 2px;
border: 1px solid transparent;
z-index: 5;
font-size: 1.3rem;
color: black;
cursor: pointer;
}
#menu a#close-btn {
position: absolute;
top: 0;
right: 0;
padding: 15px;
background: transparent;
border-radius: 2px;
border: 1px solid transparent;
z-index: 5;
font-size: 1.3rem;
color: black;
cursor: pointer;
}
#menu ul {
display: none;
position: absolute;
top: 45px;
right: 0;
margin: 0;
border: 1px solid #efefef;
border-bottom: 1px solid #ddd;
border-radius: 2px;
padding: 35px;
box-shadow: 0 1px 3px 0 #eee;
}
#menu ul li {
list-style-type: none;
}
#menu ul li a {
display: block;
text-decoration: none;
padding: 3px 0;
color: inherit;
}
#menu ul li a:hover {
text-decoration: underline;
color: black;
}
/*sidenav
.overlay {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: $secondary-color;
overflow-x: hidden;
transition: 0.5s;
}
.overlay-content {
position: relative;
top: 10%;
width: 100%;
text-align: left;
margin-top: 30px;
}
.overlay a {
padding-left: 10px;
text-decoration: none;
font-size: 26px;
color: #818181;
display: block;
transition: 0.3s;
}
.overlay a:hover,
.overlay a:focus {
color: #f1f1f1;
}
.overlay .closebtn {
position: absolute;
top: 35px;
right: 40px;
font-size: 1.3rem;
color: black !important;
}
#media screen and (max-height: 450px) {
.overlay a {
font-size: 20px
}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
*/
//heading or showcase
#heading {
position: absolute;
top: 70%;
margin-top: -150px;
text-align: left;
width: 100%;
}
#logo {
font: 27px 'Italiana', sans-serif;
text-transform: uppercase;
letter-spacing: 14px;
color: white;
background-color: black;
width: 60%;
padding: 14px 10px 10px 10px;
}
#tagline {
font-size: 22px;
}
//about section
#about {
background-color: $secondary-color;
}
Your problem is you are using absolute positioning for everything which removes the element from the normal page flow. Learn to use relative positioning and then elements will generally fall in the order they appear in the code.

How to set up fields position?

Firefox, Safari, IE
As you can see in different browsers appears 1-2 px difference between input and div, how to clear it?
HTML:
<input type="text" class="my-input-select" disabled="disabled"/>
<div class="my-input-select-box" >
<ul style="z-index:100">
<li>All</li>
<li>Products</li>
<li>Categories</li>
<li>Clients</li>
<li>News</li>
</ul>
</div>
CSS:
.my-input-select{
border: 1px solid #acacac;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 5px;
background: url(images/forms/select.png) no-repeat 98% center;
cursor: pointer;
display: block;
}
div.my-input-select-box{
position: relative;
margin: 0;
padding: 0;
}
div.my-input-select-box ul{
position: absolute;
background: red;
left: 110px;
top: 26px;
width: 172px;
z-index: 100;
margin: 0;
padding: 0;
}
div.my-input-select-box li{
border-bottom: medium none;
color: #393939;
cursor: pointer;
display: block;
font-size: 12px;
line-height: 12px;
list-style-type: none;
margin: 0;
padding: 6px 2px 6px 10px;
}
You have to use an html, css reset for example http://necolas.github.com/normalize.css/