relative positioned divs not clickable - css

Nothing in the body of this website is clickable. I can't figure out why.
The purpose of this website was to be something like lucasfilm.com, where the header overlaps the body content so the logo sorta looks like it is popping out.
For some reason I can't seem to click on anything anymore and I can't figure out why. I've included the entire page. I am knew to this so no need to go on and on about how the code is sloppy. I just want to finish this one page.
Website is www.aspdfilms.com
header, body, and footer divs are all position:relative; with z-index's. HTML and CSS are:
<div id="page">
<div id="header">
<div class="nav" id="navleft">
<a id="services" href="aboutASPD.html">
The Company
</a>
 | 
<a id="services" href="services.html">
Services
</a>
</div>
<a id="logodiv" href="index.html"></a>
<div class="nav" id="navright">
<a id="about" href="ourwork.html">
Our Work
</a>
 | 
<a id="about" href="contactus.html">
Contact
</a>
</div>
</div>
<div id="body">
<div id="container">
<div id="whitebody">
<h2>Contact Us</h2>
<p>To speak with an associate or schedule a free consultation please contact ASPD Films:</p>
<div id="contactdiv">
<div id="contactinfo">
info#ASPDfilms.com<br />
NY Contact: 347-871-3456<br />
LA Contact: 310-678-7878
</div>
<a href="docs/ASPD_vCard.vcf" style="float:right;">
Download vCard<br />
<img src="img/vcard.jpg" alt="Download vCard" />
</a>
</div>
</div>
</div>
</div>
<div id="footer">
<span id="copyright">
TM & © ASPD FILMS 2011. ALL RIGHTS RESERVED. <a id="dropmain" href="http://www.dropmain.org">BROUGHT TO YOU BY DOPMAIN.ORG</a>
</span>
</div>
</div><div id="page">
<div id="header">
<div class="nav" id="navleft">
<a id="services" href="aboutASPD.html">
The Company
</a>
 | 
<a id="services" href="services.html">
Services
</a>
</div>
<a id="logodiv" href="index.html"></a>
<div class="nav" id="navright">
<a id="about" href="ourwork.html">
Our Work
</a>
 | 
<a id="about" href="contactus.html">
Contact
</a>
</div>
</div>
<div id="body">
<div id="container">
<div id="whitebody">
<h2>Contact Us</h2>
<p>To speak with an associate or schedule a free consultation please contact ASPD Films:</p>
<div id="contactdiv">
<div id="contactinfo">
info#ASPDfilms.com<br />
NY Contact: 347-871-3456<br />
LA Contact: 310-678-7878
</div>
<a href="docs/ASPD_vCard.vcf" style="float:right;">
Download vCard<br />
<img src="img/vcard.jpg" alt="Download vCard" />
</a>
</div>
</div>
</div>
</div>
<div id="footer">
<span id="copyright">
TM & © ASPD FILMS 2011. ALL RIGHTS RESERVED. <a id="dropmain" href="http://www.dropmain.org">BROUGHT TO YOU BY DOPMAIN.ORG</a>
</span>
</div>
</div>
body
{
background-color:#000000;
color:#ffffff;
text-align:center;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-weight:100;
}
a
{
text-decoration:none;
}
img
{
border:none;
-o-border-radius: 0px 0px 15px 15px;
-moz-border-radius: 0px 0px 15px 15px;
-webkit-border-radius: 0px 0px 15px 15px;
border-radius: 0px 0px 15px 15px;
-khtml-border-radius: 0px 0px 15px 15px;
}
h2
{
margin-left:30px;
margin-top:30px;
}
#page
{
margin:0px auto;
width:1400px;
}
#header
{
width:1400px; height:87px;
margin-top:20px;
background-color:#ffffff;
background:url('img/header.png');
z-index:10;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
.nav
{
height:32px;
font-size:14px;
background-color:transparent;
margin-top:35px;
z-index:300;
letter-spacing:4px;
}
.nav a
{
color:#123456;
}
.nav a:hover
{
color:#000000;
text-shadow: 0 0 0.2 #000, 0 0 0.2em #000, 0 0 0.2em #000, 0 0 0.2em #000;
}
#navleft
{
width:540px;
text-align:right;
float:left;
}
#logodiv
{
width:200px; height:80px;
margin-left:65px;
background-color:transparent;
cursor:pointer;
float:left;
}
#navright
{
width:480px;
text-align:left;
float:right;
}
#body
{
width:1400px; height:600px;
background-color:#736F6E;
top:-28px;
overflow:hidden;
text-align:left;
z-index:-10;
position:relative;
-o-border-radius: 0px 0px 15px 15px;
-moz-border-radius: 0px 0px 15px 15px;
-webkit-border-radius: 0px 0px 15px 15px;
border-radius: 0px 0px 15px 15px;
-khtml-border-radius: 0px 0px 15px 15px;
}
#container
{
width:980px; height:600px;
margin:8px auto;
background-color:transparent;
color:#000000;
}
#whitebody
{
width:980px; height:585px;
float:left;
background:#ffffff;
}
#whitebody p
{
margin:20px;
}
#contactdiv
{
width:500px;
margin:0 auto;
}
#contactinfo
{
width:250px;
float:left;
}
#footer
{
width:1400px; height:25px;
background-color:#000000;
text-align:center;
top:-28px;
position:relative;
}
#copyright
{
color:#777f76;
font-size:10px;
}
#dropmain
{
color:#777f76;
}
#dropmain:hover
{
color:#FFA500;
}

I'm not sure what's happening here - it seems to be caused by z-index:-10 on #body - but you can fix it by:
removing position:relative from #body
adding position:relative to #header
(there's a z-index on #header, but that won't do anything unless you add relative positioning)
Addionally, I found a link exploring the problem more in detail: http://www.jonasknutsen.com/2011/10/09/negative-z-index-kills-links/

Related

how to fix element position and and make it responsive

I have a html, css and js:
$(document).ready(function() {
$('#friends-chats-noti-button').on("click", function(e, data) {
// TOGGLE (SHOW OR HIDE) NOTIFICATION WINDOW.
$('#friends-chats').fadeToggle('fast', 'linear', function() {
if ($('#friends-chats').is(':hidden')) {}
});
});
});
/* friends chats */
#friends-chats-container {
position:relative;
margin-right:10px;
margin-left:10px;
}
/* A CIRCLE LIKE BUTTON IN THE TOP MENU. */
#friends-chats-noti-button {
width:22px;
height:22px;
line-height:22px;
cursor:pointer;
}
/* THE NOTIFICAIONS WINDOW. THIS REMAINS HIDDEN WHEN THE PAGE LOADS. */
#friends-chats {
display:none;
width:900px;
top:55px;
right:10%;
background:#FFF;
border:solid 1px rgba(100, 100, 100, .20);
-webkit-box-shadow:0 3px 8px rgba(0, 0, 0, .20);
z-index: 1000;
}
/* AN ARROW LIKE STRUCTURE JUST OVER THE NOTIFICATIONS WINDOW */
#notifications:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:345px;
}
#friends-chats:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:870px;
}
.messaging { padding: 0 0 50px 0;}
.msg_history {
height: 516px;
overflow-y: auto;
}
#chat-message-input-private
{
margin: 1% 0 1% 1%;
width: 80%;
height: 68px;
font-size: 18px;
}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<nav class="navbar navbar-default">
<ul class="nav navbar-nav navbar-right">
<li id="friends-chats-container">
<div id="friends-chats-noti-button">
<i class="fa fa-comments-o fa-2x" aria-hidden="true"></i>
</div>
<div>
<p> other element </p>
</div>
<div id="friends-chats">
<div class="container">
<h3 class=" text-center">Messaging</h3>
<div class="messaging">
<div class="inbox_msg">
<div class="inbox_people">
<div class="headind_srch">
<div class="recent_heading">
<h4>Recent</h4>
</div>
</div>
<div class="inbox_chat" id="inbox_chat">
</div>
</div>
<div class="mesgs">
<div class="msg_history" id="msg_history">
</div>
<div class="inputContainer">
<input id="chat-message-input-private" autocomplete="off" placeholder="Type your message...">
</div>
</div>
</div>
</div>
<!---->
</div>
</div>
</li>
</ul>
</nav>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
as you can see, there is a message icon on top-right side of the page.
what i want to get is
when click the message icon, the message window will pop out and don't impact other element's position.
when narrow the window, the message window can be responsive.
i already try several hours, but still haven't get good result, please help me. thanks everyone.
I think you forgot about adding the line position: abosolute;
I added it for you here. And I made the popup smaller so that you can see clearly
$(document).ready(function() {
$('#friends-chats-noti-button').on("click", function(e, data) {
// TOGGLE (SHOW OR HIDE) NOTIFICATION WINDOW.
$('#friends-chats').fadeToggle('fast', 'linear', function() {
if ($('#friends-chats').is(':hidden')) {}
});
});
});
/* friends chats */
#friends-chats-container {
position:relative;
margin-right:10px;
margin-left:10px;
padding: 0 15px;
}
/* A CIRCLE LIKE BUTTON IN THE TOP MENU. */
#friends-chats-noti-button {
width:22px;
height:22px;
line-height:22px;
cursor:pointer;
}
/* THE NOTIFICAIONS WINDOW. THIS REMAINS HIDDEN WHEN THE PAGE LOADS. */
#friends-chats {
display:none;
width:600px;
top:55px;
right:10%;
background:#FFF;
border:solid 1px rgba(100, 100, 100, .20);
-webkit-box-shadow:0 3px 8px rgba(0, 0, 0, .20);
z-index: 1000;
position: absolute;
}
/* AN ARROW LIKE STRUCTURE JUST OVER THE NOTIFICATIONS WINDOW */
#notifications:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:345px;
}
#friends-chats:before {
content: '';
display:block;
width:0;
height:0;
color:transparent;
border:10px solid #CCC;
border-color:transparent transparent #fff;
margin-top:-20px;
margin-left:870px;
}
.messaging { padding: 0 0 50px 0;}
.msg_history {
height: 516px;
overflow-y: auto;
}
#chat-message-input-private
{
margin: 1% 0 1% 1%;
width: 80%;
height: 68px;
font-size: 18px;
}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<nav class="navbar navbar-default">
<ul class="nav navbar-nav navbar-right">
<li id="friends-chats-container">
<div id="friends-chats-noti-button">
<i class="fa fa-comments-o fa-2x" aria-hidden="true"></i>
</div>
<div>
<p> other element </p>
</div>
<div id="friends-chats">
<div class="container">
<h3 class=" text-center">Messaging</h3>
<div class="messaging">
<div class="inbox_msg">
<div class="inbox_people">
<div class="headind_srch">
<div class="recent_heading">
<h4>Recent</h4>
</div>
</div>
<div class="inbox_chat" id="inbox_chat">
</div>
</div>
<div class="mesgs">
<div class="msg_history" id="msg_history">
</div>
<div class="inputContainer">
<input id="chat-message-input-private" autocomplete="off" placeholder="Type your message...">
</div>
</div>
</div>
</div>
<!---->
</div>
</div>
</li>
</ul>
</nav>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>
<div>some element</div>

Div not aligning properly

I have the following alignment problem: I want the "random" div to have a full width in the window, that's why I added the "width:100%" command. But for some reason, the maximum width it displays the random div on is the width of the "fixedwidth" div, but the two are not connected. Why does the browser keep matching the maximum width of the two divs? If i increase the width of the "fixedwitdth" div, then the width of the "random div" also increases. But that does not make any sense.
<html>
<head>
<title>Gliga's BBC</title>
<style type="text/css">
body {
margin:0px;
font-family: arial,helvetica;
}
#topbar {
background-color:#7A0000;
width:100%;
height:40px;
color:white;
}
.fixedwidth {
width:1200px;
background-color:green;
margin:0 auto;
}
#logodiv {
padding-top:7px;
padding-bottom:3px;
padding-left:50px;
float:left;
border-right: 2px solid #990000;
padding-right:30px;
}
#signindiv {
font-weight:bold;
padding:9px 80px 11px 20px;
font-size:0.9 em;
float:left;
border-right: 2px solid #990000;
}
#topmenudiv {
float:left;
}
#topmenudiv ul {
margin:0;
padding:0;
}
#topmenudiv li {
list-style:none;
font-weight:bold;
font-size:0.9 em;
border-right: 2px solid #990000;
height:100%;
padding:10px 20px 10px 20px;
float:left;
}
#searchdiv {
float:left;
padding:6px 10px 5px; 5px;
border-right: 2px solid #990000;
}
#searchdiv input{
height:20px;
}
.break {
clear: both;
}
.random {
background-color:blue;
margin-top:10px;
height:30px;
width:100%;
}
</style>
</head>
<body>
<div id="container">
<div id="topbar">
<div class="fixedwidth">
<div id="logodiv">
<img src="images/bbclogo.png"/>
</div>
<div id="signindiv">
Sign in
</div>
<div id="topmenudiv">
<ul>
<li>News</li>
<li>Sport</li>
<li>Weather</li>
<li>iPLayer</li>
<li>TV</li>
<li>Radio</li>
<li>More...</li>
</li>
</ul>
</div>
<div id="searchdiv">
<input type="text" placeholder="Search..." />
<div>
</div>
</div>
<div class="break" />
<div class="random">
</div>
</div>
</body>
</html>
.random is a child of .fixedwidth, so it's a totally normal behaviour happening there.
If you sort your code properly then you will get to see it clearly:

Strange css floating behaviour

Why is the professor div not floating to the left? It is "hanging up" on the members container. The main container containing all of the red divs does not have a set height so the professor div has room to go to the left so to say. The divs are set to float left in case it wasn't apparent. I know what's wrong, How do I fix it?
<div id="displayEventInfoDiv">
<div class="eventInfoDiv">
<p id="infoClassTitle" class="eventInfoTitle">Class:</p>
<p id="infoClassP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoLocationTitle" class="eventInfoTitle">Location:</p>
<p id="infoLocationP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoTimeTitle" class="eventInfoTitle">Time:</p>
<p id="infoTimeP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoToolsTitle" class="eventInfoTitle">Tools:</p>
<p id="infoToolsP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoMessageTitle" class="eventInfoTitle">Message:</p>
<p id="infoMessageP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoMembersTitle" class="eventInfoTitle">Members:</p>
<p id="infoMembersP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoSectionTitle" class="eventInfoTitle">Section:</p>
<p id="infoSectionP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoNumberTitle" class="eventInfoTitle">Course Number:</p>
<p id="infoNumberP" class="eventInfoP"></p>
</div>
<div class="eventInfoDiv">
<p id="infoProfessorTitle" class="eventInfoTitle">Professor:</p>
<p id="infoProfessorP" class="eventInfoP"></p>
</div>
<button id="exitEventInfoDivButton">exit</button>
</div>
#displayEventInfoDiv // main container
{
position:absolute;
width:60%;
left:20%;
padding: 10px 10px 40px 10px;
background-color: rgba(0,0,0,0.7);;
border-radius: 10px;
display:none;
z-index: 30;
}
#exitEventInfoDivButton // exit button
{
position:absolute;
bottom:10px;
right:10px;
height:30px;
width:80px;
background-color: rgba(255,255,255,0.4);
font-size:20px;
color:black;
border-radius: 10px;
border:none;
outline:none;
font-family: 'Indie Flower', cursive;
cursor:pointer;
}
.eventInfoDiv // red div
{
width:200px;
float:left;
padding: 0 10px 0 10px;
background-color:red;
border:3px solid black;
}
.eventInfoTitle //titles
{
height:30px;
width:100%;
font-size:25px;
color:white;
text-align:center;
margin:0 0 20px 0;
}
.eventInfoP // info under titles
{
width:100%;
border-radius: 10px;
text-align:center;
font-size:20px;
background-color: rgba(255,255,255,0.4);
padding: 10px 0 10px 0;
}
I would either add an extra class to members to resize it properly, so you're Professor div is not sitting next to it because of float: left.
Or target you're professor div and set it to: clear:both
You can do this by using
<div class="eventInfoDiv professor">
<p id="infoProfessorTitle" class="eventInfoTitle">Professor:</p>
<p id="infoProfessorP" class="eventInfoP"></p>
</div>
.professor {
clear: both;
}

CSS ids, classes and layouts

[Currently at: http://www.jsfiddle.net/tqtFg Michael Durrant]
I'm very new to css and I'm trying to create a website with a logo and navigation panel side by side. If you visit the site initially the panel appears out of the 'topcontent', just below and to the right in fact, but if you clicked the logo to go to the same page the panel appears where i'd like it to be!
My Site : http://acews.x10.mx
it seems something is not being intialized when first opened, but I can't tell what. here's my html code;
<div id="topcontent">
<div id="top">
<a href="index.html">
<img src="logo.png">
</a>
<div id="navbar">
<ul id="menubar">
<li class="menuButton">Home</li>
<li class="menuButton"><a href="about.html" >About ACE</a></li>
<li class="menuButton"><a href="login.html" >Customer Login</a></li>
</ul>
</div>
</div>
Here's my css code;
body {
}
/*Content page divider*/
#topcontent {
/* margin: 50px auto; */
height: 170px;
margin-left:auto;
margin-right:auto;
background-image:url('backgroundcolor.png');
}
#top {
height: 170px;
width: 900px;
margin-left:auto;
margin-right:auto;
}
/* MenuBar */
#navbar {
margin-top:60px;
float:right;
}
ul#menubar {
/* margin:20px; */
list-style:none;
margin-left:auto;
margin-right:auto;
padding: 5px 10px 0 10px;
}
ul#menubar li {
display:inline;
font-family: calibri;
font-weight: bold;
margin-left:10px;
}
ul#menubar li a {
text-decoration:none;
text-align:center;
padding:5px 10px;
/* width:100px; */
color:#FFFFFF;
float:left;
font-size:26px;
}
.menuButton a:hover{
background-color:#618E00;
text-decoration: none;
-webkit-border-radius: 5px;
}
add id for link with logo:
<a href="index.html" id="logo">
<img src="logo.png">
</a>
and CSS
#logo {float:left;}
link with logo is like one single line, if you add float to it should be ok.

css text-align/positioning question

The situation: I have several lists; in each of these lists, the text inside the first li is positioned slightly to the right of center, instead of exactly in the center like the following li elements. In the following example, the second row text ("Site Map") is not centered. Any ideas?
The html:
<body>
<!-- <div class="header">Module Settings</div> -->
<div class="left_content">
<div id="header_nav" class="moduleTypeContent" style="top:-50px" name="header_nav">
<div class="moduleTypeHeader">
<div class="text-center">header_nav</div>
</div>
<ol class="connectedSortable sortable used nonest">
<li id="list_39">
<div class="listItemContents">
<div class="moduleTypeItem left">
<img src="common/images/icons/shadowed/cross-circle.png" alt="Delete Site Map" width="16" height="16" border="0" class="icon rightspace" />
</div>
<div class="moduleTypeItem center text-center">
Site Map
</div>
<div class="moduleTypeItem right text-center">
all
</div>
</div>
</li>
<li id="list_38">
<div class="listItemContents">
<div class="moduleTypeItem left">
<img src="common/images/icons/shadowed/cross-circle.png" alt="Delete Contact Us" width="16" height="16" border="0" class="icon rightspace" />
</div>
<div class="moduleTypeItem center text-center">
Contact Us
</div>
<div class="moduleTypeItem right text-center">
all
</div>
</div>
</li>
<li id="list_6">
<div class="listItemContents">
<div class="moduleTypeItem left">
<img src="common/images/icons/shadowed/cross-circle.png" alt="Delete Help" width="16" height="16" border="0" class="icon rightspace" />
</div>
<div class="moduleTypeItem center text-center">
Help
</div>
<div class="moduleTypeItem right text-center">
all
</div>
</div>
</li>
</ol>
</div>
</div>
and the relevant css:
html, body {
height:100%
}
body {
margin: 0px;
font-size: 12px;
font-family: Arial;
font-family: Arial, Verdana, Univers;
background-color: #f0eff0;
}
ol {
border: 0 solid #aeaeae;
border-width: 0;
margin: 0;
padding: 0;
padding-left: 30px;
}
ol.sortable, ol.sortable ol {
margin: 0 0 0 25px;
padding: 0;
list-style-type: none;
}
ol.sortable {
margin: 4em 0;
}
.sortable li {
margin: 0 0 0 0;
padding: 0;
}
.sortable li div {
border: 0 solid #aeaeae;
border-width: 1px;
padding: 0px;
margin: 0;
cursor: move;
}
div.moduleTypeDiv {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 12px;
width:100%;
}
div.moduleTypeHeader {
border:1px solid #6d6d6d;
padding: 6px;
}
div.moduleTypeHeader {
background: #336699 url(../images/table_header_highlight.png) repeat-x bottom;
font-weight:bold;
color: #ffffff;
}
div.moduleTypeHeader a {
color: #ffffff;
}
.left_content{
width:48%;
float: left;
}
.moduleTypeContent{
position:relative;
top: -50px;
}
.moduleTypeHeader{
position: relative;
bottom: -48px;
}
.legendItem.left, .moduleTypeItem.left{
float: left;
width: 18px;
padding: 5px;
border:0px ;
border-right: 1px solid #aeaeae;
}
.legendItem.center, .moduleTypeItem.center {
padding:6px;
border:0px ;
}
.legendItem.right, .moduleTypeItem.right {
position: relative;
top: -25px;
float: right;
width: 100px;
padding:6px;
width:50px;
border:0px ;
border-left: 1px solid #aeaeae;
}
.listItemContents {
position:relative;
}
.text-center { text-align:center; }
Thanks!
p.s. I created a fiddle: http://jsfiddle.net/earachefl/c2bcc/
You are doing some really weird positioning on the right "column" elements by floating the right, but not actually leaving them any space for them on the line they belong, so they are pushed down a row and then using relative positioning is "hack" them back where you want them. And thus there is no item in the first line that would push the text left so that it would appear centered.
Simple solution: Use a table. Your code is a prime example of bad "CSS hacking" because of misunderstanding the rule "Don't use tables for layout". Please, use a table. Please.
EDIT:
Since you can't use a table, here's what you have to do:
Move the "right" column to the first position in the list item
Give the center column a right margin wide enough for the right column to fit it. (63px = 50px width + 2 * 6px padding + 1px left-border)
http://jsfiddle.net/Se87U/1/

Resources