This is my question about the dropdown menu which open behind the div.
Here is my HTML code:
<div style="position:relative; left:0px; top:0px;">
<div style="background-color: white; width: 100%;">
<div class="styled-select">
<select id="campaignListId" name="campaignId" onmousedown="if(this.options.length>5){this.size=5;}" onchange='this.size=0;' onblur="this.size=0;" style="z-index:99999">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
<option value="4">Fourth</option>
<option value="5">Fifth</option>
<option value="6">Sixth</option>
<option value="7">Seventh</option>
<option value="8">Eighth</option>
<option value="9">Ninth</option>
<option value="10">Tenth</option>
</select>
</div>
<div style="background-color: grey; width: 100%; height:400px; left: 0px; ">
<div style="width: 944px; margin: 0 auto; ">
<font style="font-size: 22px; font-weight: bold; ">
<span id="spanMOV" style="cursor: pointer; color: #4F9DD0; text-decoration: underline; " >
Movies
</span>
<span id="spanGAM" style="cursor: pointer;" >
Games
</span>
<span id="spanRES" style="cursor: pointer;" >
Restaurant
</span>
</div>
</div>
</div>
</div>
And this is my CSS code:
<style type="text/css">
.styled-select select {
position: absolute;
background: transparent;
width: 944px;
padding: 5px;
font-size: 32px;
font-weight: bold;
font-family: 'PT Sans', sans-serif;
color: #4F9DD0;
line-height: 1;
border: 0;
border-radius: 0;
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
}
.styled-select {
overflow: hidden;
background: url(resources/img/campaignSelector.png) no-repeat right #ddd;
background-color: white;
width: 944px;
height: 48px;
position: relative;
margin: 0 auto;
}
The problem is that, whenever I click on the select dropdown, it opens behind the <div> after that. I had tried z-index but it did not work.
Remove the overflow: hidden; from .styled-select and it shows up infront of it. If you want it to have a white background then, you need to change background: transparent on .styled-select select to background: white.
Try after removing position:relative.
.styled-select {
overflow: hidden;
background: url(resources/img/campaignSelector.png) no-repeat right #ddd;
background-color: white;
width: 944px;
height: 48px;
/*position: relative; */
margin: 0 auto;
}
OR
.styled-select {
/*overflow: hidden;*/
background: url(resources/img/campaignSelector.png) no-repeat right #ddd;
background-color: white;
width: 944px;
height: 48px;
position: relative;
margin: 0 auto;
}
Its works for me.
Related
I'm working on a web-page of the solar system. The idea is that you click on a picture of one of the planets and it will take you to another html page about that planet. I've been trying to figure out how to make create a link to another html doc via a button image, but I haven't been able to figure it out.
body {
margin: 0;
padding: 0;
background: #004882;
display: flex;
flex-direction: column;
}
html {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
.header {
width: 100%;
height: 150px;
display: black;
background-color: #101010
/* A lot of the information I got for making the header I got from this youtube video
https://www.youtube.com/watch?v=GxwHXxumdQk
*/
}
.logo {
height: 100%;
display: table;
float: left;
}
.logo h1 {
color: white;
height: 100%;
display: table-cell;
vertical-align: middle;
text-align: center;
font-family: "Lucida Console", Courier, monospace;
font-size: 50px;
}
.logo h3 {
color: white;
height: 100%;
display: table-cell;
vertical-align: middle;
text-align: center;
font-family: "Lucida Console", Courier, monospace;
}
.navigation {
float: right;
height: 100%;
}
.navigation a {
height: 100%;
display: table;
;
float: left;
padding: 0px 20px;
}
.drop-down {
display: table-cell;
vertical-align: middle;
;
height: 100%;
color: white;
font-family: monospace;
background-color: gray;
font-size: 20px;
}
.drop-down select {
font-family: monospace;
font-weight: bold;
font-style: italic;
font-size: 15px;
}
.drop-down button {
font-family: monospace;
background-color: gray;
color: white;
font-size: 20px;
}
.drop-down button:hover {
background-color: #008B8B;
}
.planets img {
height: 300px;
width: 300px;
border-radius: 50%;
min-height: 100%;
}
/* I got some info on arranging the layout of the
imgaes from here
https://stackoverflow.com/questions/12813573/position-icons-into-circle
*/
.planets {
position: relative;
padding: 2.8em;
border: dashed 3px;
border-radius: 50%;
margin: 1.75em auto 0;
flex: 1;
}
.planets a {
display: block;
position: absolute;
top: 50%;
left: 50%;
width: 4em;
height: 4em;
margin: -2em;
}
#footer {
height: 100%;
width: 100%;
background: black;
color: white;
align-self: flex-end;
bottom: 20px;
}
#footer img {
height: 150px;
width: 150px;
border-radius: 50%;
}
#footer h4 {
color: white;
font-family: monospace;
font-size: 30px;
text-align: center;
}
.paragraph {
color: white;
font-family: monospace;
font-size: 20px;
text-align: center;
}
#footer button {
color: white;
background-color: gray;
}
#footer button:hover {
background-color: #FF6347;
}
#footer a {
background-color: gray;
color: white;
width: 100px;
font-size: 16px;
}
#footer a:hover {
background-color: #FF6347;
}
#footer .contact-links img {
border-radius: 100%;
height: 30px;
width: 30px;
border-radius: 100%;
}
aside {
position: relative;
left: 1720px;
height: 500px;
width: 30px;
}
aside .twitter-timeline {
height: 1000px;
width: 300px;
}
main {
margin-right: 60%;
}
<header class="header">
<div class="logo">
<h1>Neighbors from Space</h1>
<br>
<h3> Created by Evan O'Grady</h3>
</div>
</header>
<nav class="drop-down">
<a href="#About">
<button type="button">About</button>
</a>
<label for="planets-nav"><strong>Planets: </strong></label>
<select id="planets">
<option value="Mercury">Mercury</option>
<option value="Venus">Venus</option>
<option value="Earth">Earth</option>
<option value="Mars">Mars</option>
<option value="Jupiter">Jupiter</option>
<option value="Saturn">Saturn</option>
<option value="Uranus">Uranus</option>
<option value="Neptune">Neptune</option>
</select>
<label for="references"><strong>References for: </strong></label>
<select id="references">
<option value="Mercury">Mercury</option>
<option value="Venus">Venus</option>
<option value="Earth">Earth</option>
<option value="Mars">Mars</option>
<option value="Jupiter">Jupiter</option>
<option value="Saturn">Saturn</option>
<option value="Uranus">Uranus</option>
<option value="Neptune">Neptune</option>
</select>
<label for="contact"><strong>Contact: </strong></label>
<select id="contact">
<a href="mailto:evanogrady603#gmail.com">
<option value="email">Email</option>
</a>
<a href="https://www.linkedin.com/in/evan-o-grady-2a425218a/">
<option value="linkedin">LinkedIn</option>
</a>
<a href="https://github.com/evanOGrady">
<option value="github">GitHub</option>
</a>
</select>
</nav>
<main class="planets">
<img src="C:\Users\evano\Downloads\Mercury.jpg" alt="Mercury">
<img src="C:\Users\evano\Downloads\Venus.jpg" alt="Venus">
<img src="C:\Users\evano\Downloads\Earth.jpg" alt="Earth">
<img src="C:\Users\evano\Downloads\Mars.jpg" alt="Mars">
<img src="C:\Users\evano\Downloads\Jupiter.jpg" alt="Jupiter">
<img src="C:\Users\evano\Downloads\Saturn.jpeg" alt="Saturn">
<img src="C:\Users\evano\Downloads\Uranus.jpg" alt="Uranus">
<img src="C:\Users\evano\Downloads\Neptune.jpg" alt="Neptune">
</main>
<aside>
<a class="twitter-timeline" data-width="400" data-height="500" data-theme="dark" href="https://twitter.com/NASA?ref_src=twsrc%5Etfw">Tweets by NASA</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</aside>
<!-- I had trouble making the footer, so I got some help from stack overflow
https://stackoverflow.com/questions/60687447/why-isnt-my-footer-at-the-bottom-of-the-page/60688208?noredirect=1#comment107377432_60688208
-->
<footer id="footer">
<h4 id="About">About The Creator...</h4>
<img src="C:\Users\evano\Downloads\Evan NASA.jpg" align="evanNasa">
<div class="paragraph">
<p>Evan O'Grady is a Software Development student at NHTI-Concord's Community College in Concord, New Hampshire in the United States. He created this website as a school project for his web devlopment class. In his free time Evan enjoys, hiking, playing
guitar, playing piano, and drawing.</p>
</div>
<div class="contact-links">
<img src="C:\Users\evano\Downloads\email.jpeg" alt="email">
evanogrady603#gmail.com
<br>
<img src="C:\Users\evano\Downloads\github.jpeg">
<a href="https://github.com/evanOGrady">
<button onclick="https://github.com/evanOGrady">https://github.com/evanOGrady</button>
</a>
<br>
<img src="C:\Users\evano\Downloads\linkedin.jpeg">
<a href="https://www.linkedin.com/in/evan-o-grady-2a425218a/">
<button type="button">www.linkedin.com/in/evanogrady</button>
</a>
<br>
</div>
</footer>
To create a link using a picture simply surround your img src with the link, like this:
<img src="C:\Users\evano\Downloads\Mercury.jpg" alt="Mercury">
If you wanted a text link then it's like this:
Click here
You would use an anchor tag. See the code below:
<a href="[place the title of the HTML page here with extension.html]" target="_blank">
<img src="img/imagenamehere.jpg" width="200px" height="200px" alt="image name">
</a>
I'm trying to fix an issue with a hoverable span in html. Inside the span element is a html-select option. When I try to select something, the hoverable span disappears.
This issue only occurs in Firefox. In Chrome I don't have this issue.
HTML Part:
<span class="over">
<i class="fa fa-cogs edit"></i>
<div>
<form method="post" accept-charset="utf-8" action="/edit">
<div class="input select">
<label for="select-id">Select</label>
<select name="select_id" id="select-id">
<option value="">-- select --</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
</select>
</div>
</form>
</div>
</span>
SCSS Part:
.over{
margin-right: 0.5em;
&>i{
color: #bbbbbb;
padding: 2px;
}
&>a{
padding: 2px;
display: none;
&:hover{
color: #000;
}
}
&>div{
display: none;
position: absolute;
border: 1px solid #ccc;
margin: 6px 0 0 -20px;
padding: 2px;
background: white;
border-radius: 4px;
min-width: 140px;
z-index: 100;
text-align: left;
input, select{
padding: 0 5px;
line-height: 1.5em;
width: auto;
display: inline-block;
}
label{
margin: -4px 4px;
display: inline-block;
}
}
&:hover{
border: 1px solid;
border-radius: 4px;
&>i{
color: #000;
}
&>a{
display: inherit;
}
&>div{
display: inline-block;
}
}
}
}
In Chrome I can hover over the span item and select a option from the select-element. Even if I leave the hoverable area.
In Firefox I can also hover over the div, but as soon as I leave the hoverable area, the box disappears and I cannot select an Item.
Problem seems to be fixed in Firefox now.
Here is the CSS and HTML that I am working with. I already tried at #media only screen. It didn't work so I got rid of that portion of code.
I will copy and paste my html and css down below. The code you see down below is mostly all I have so far.
Again I need a way to make the webpage fit all screens without shifting from their original positions and layout.
HTML-
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>ListeningHere</title>
<link href="css.css" rel="StyleSheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
</head>
<body>
<h1><img src="listening_here.png" alt="ListeningHere"></h1>
<div class="invisible">
<div class="first">
<h2>What is the season?</h2>
<div class="box">
<select name="season">
<option value=""></option>
<option value="Winter">Winter</option>
<option value="Summer">Summer</option>
<option value="Spring">Spring</option>
<option value="Fall">Fall</option>
</select>
</div>
</div>
<div class="first">
<h2>What is the time of day?</h2>
<div class="box">
<select name="season">
<option value=""></option>
<option value="Morning">Morning</option>
<option value="Afternoon">Afternoon</option>
<option value="Evening">Evening</option>
<option value="Night">Night</option>
</select>
</div>
</div>
<div class="first">
<h2>What is the weather like?</h2>
<div class="box">
<select name="season">
<option value=""></option>
<option value="Sunny">Sunny</option>
<option value="Rainy">Rainy</option>
<option value="Cloudy">Cloudy</option>
<option value="Snowy">Snowy</option>
</select>
</div>
</div>
<div class="fourth">
<button>Submit</button>
</div>
</div>
</body>
</html>
CSS-
body {
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 0;
height: 100%;
width: 100%;
font-family: Lato, sans-serif;
font color: black;
font-weight: 400;
background-color: #C1E5E5;
}
h1 {
padding-left: 50px;
}
h3 {
text-align: center;
font-size: 500%;
font-style: normal;
font-weight: 400;
}
.invisible {
margin:auto;
border-radius: 15px;
background-color: whitesmoke;
padding: 30px;
width: 60%;
height: 500px;
}
.first {
height: 150px;
width: 90%;
float: left;
text-align: center;
background-color: whitesmoke;
}
.second {
height: 150px;
width:90%;
float: left;
text-align: center;
background-color: whitesmoke;
}
.third {
height: 150px;
width:90%;
float: left;
text-align: center;
background-color: whitesmoke;
}
.fourth {
height: 50px;
width: 90%;
float: left;
text-align: center;
background-color: whitesmoke;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%;
border-radius: 8px;
}
.box {
position: absolute;
padding-left: 265px;
padding-right: 50px;
text-align: center;
}
.box select {
background: blue;
color: white;
padding: 10px;
width: 250px;
height: 50px;
border: none;
font-size: 20px;
box-shadow: 0 5px 25px rgba(0,0,0,.5);
-webkit appearance: button;
outline: none;
}
Change your .box to
.box {
margin-right: 5%;
text-align: center;
}
This worked for me. However I wasn't using whatever image you have so hopefully that wont interfere. Using position absolute is often a bad idea when trying to make a responsive website.
When I am testing my responsive HTML pages in cross browser compatibility, Am facing select drop down options problem in Chrome browser it's showing blank black rectangular as per the attachment.
HTML
<body>
<div class="container">
<div class="select-wrapper">
<select class="select" >
<option value="1" selected="selected">Option Number 1</option>
<option value="2">A Much Longer Option Than Option 1</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="4">Option 4</option>
</select>
<span class="select-icon entypo-arrow-combo"></span>
</div>
</div>
</body>
CSS
#import "compass/css3";
#import url(http://weloveiconfonts.com/api/?family=entypo);
[class*="entypo-"]:before {
font: 1.4em 'entypo', sans-serif;
}
/// Styles/
body {
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #333;
`}
.container {
margin: 5em auto 0;
width: 25%;
}
.select-wrapper {
background-color: #eee;
border: 1px solid #aaa;
color: #aaa;
cursor: pointer;
float: left;
overflow: hidden;
padding-right: 3em;
position: relative;
width: 100%;
}
.select {
-webkit-appearance: none;
background-color: #eee;
border-width: 0;
box-sizing: border-box;
cursor: pointer;
float: left;
font-size: 1em;
line-height: 1em;
padding: 1em 1em;
width: 100%;
width: calc(100% + 2em);
&:focus {
outline: none;
}
}
.select-icon {
position: absolute;
top: .8em;
right: 1em;
}
Finally got a solution : I'm using Google Chrome version 53.0.2785.143m after updating Chrome(Version 54.0.2840.59 m) It's working fine.
I'm admitting right at the start: this is my first attempt at HTML/CSS coding. So please excuse my code's messiness.
I have two problems: 1. When I shrink my browser window small enough to see a scroll bar, my three drop down menus disappear. 2. I am trying to center my button (Find Resources), but can't figure it out. I've tried auto-ing my left and right margins, I tried text aligning, but it messed up the placement of my three boxes (which have a width of 200px).
Thanks for any help someone can offer!
HTML:
<div id="resource-wrapper">
<div id="content">
<p class="resource-p">Welcome to Our Resource Center.</p>
<p class="resource-p">How may we help you?</p>
</div>
<div id=buttons-div>
<div id=select>
<select class="dropdown" name="field_related_brands_nid">
<option value="All" selected="selected">Any</option>
<option value="2511">Sample</option>
</select>
<select class="dropdown-2" name="field_related_technology_nid">
<option value="All" selected="selected">Any</option>
<option value="444">Sample</option>
</select>
<select class="dropdown-3" name="field_resource_type_value_many_to_one">
<option value="All" selected="selected">Any</option>
<option value="multimedia">Sample</option>
</select>
</div>
<div id=buttons>
<img src="Images/Buttons1.jpg" class="resource-image">
<img src="Images/Buttons2.jpg" class="resource-image">
<img src="Images/buttons3.jpg" class="resource-image">
</div>
<button type="submit" class="resource-p1">Find Resources</button>
</div>
</div>
CSS:
#resource-wrapper {
width: 850px;
margin: 0 auto;}
#content {
background-color: #669bcf;
padding: 1px;
width: 100%;}
.resource-p {
text-align: center;
font-size: 30px;
font-family: sans-serif;
color: white;
line-height: 15px}
#buttons-div {
position: relative;
width: 850px;}
#select {
position: fixed;
margin-top: 214px;
width: 850px;}
.dropdown {
width: 160px;
margin-left: 78px;}
.dropdown-2 {
width: 125px;
margin-left: 115px;}
.dropdown-3 {
width: 95px;
margin-left: 148px;}
.resource-image {
margin: 50px 0 0 58px;}
.resource-p1 {
padding: 16px 18px 13px 18px;
margin: 20px;
text-align: center;
font-size: 21px;
font-family: sans-serif;
color: white;
font-weight: bold;
background-color: #669bcf;
border-style: solid;
border-width: 1px 1px 3px 1px;
border-color: #d7e4f4;
border-radius: 5px;}
Your Dropdowns shouldn't stack as nothing is responsive in your site. If they have a set width like width: 800px; They should be fine. However make sure to have all your id's surrounded with a quote:
<div id=buttons-div>
should be
<div id="buttons-div">
To Center your Resource Button:
.resource-p1 {
margin: 12px auto;
text-align: center;
font-size: 21px;
font-family: sans-serif;
color: white;
font-weight: bold;
background-color: #669bcf;
border-style: solid;
border-width: 1px 1px 3px 1px;
border-color: #d7e4f4;
border-radius: 5px;
display: block;
}
DEMO
1) Change #select's position from fixed to absolute
2) Wrap your button in a container and give that container text-align:center
HTML
<div id="find-resources-container">
<button type="submit" class="resource-p1">Find Resources</button>
</div>
CSS
#find-resources-container {
text-align:center
}