Conflicting issues with position: relative; - html

I recently edited the way a template was designed for MyBB. Fortunately, I made it exactly how I expected it to look, however, the navigation bar seemed broke. After trying to navigate, I realized that I could only click on the lower half of the navigation.
http://gyazo.com/99337bd5252b37e118ce119d5168bcf3
As you can see where I painted the red boxes is the only place where the link activation works. After about 2 hours I found out my problem was due to a "position: relative;". When I remove it, the navigation works fine but my panel div becomes moved all the way to the right and out of position.
<div class="main-bg">
<div class="main-width">
<a name="top" id="top"></a>
<div class="top-bar blue-texture"></div>
<div id="header">
<div id="panel">
{$welcomeblock}
</div>
<div class="logo" >
<img src="{$theme['logo']}" alt="{$mybb- >settings['bbname']}" title="{$mybb->settings['bbname']}" />
</div>
<hr class="hidden" />
</div>
</div>
</div>
<div id="container">
<div class="bg-img">
</div>
<hr class="hidden" />
<div class="menu blue-texture">
<span class="search">
<form action="search.php" method="post">
<input type="hidden" name="action" value="do_search" />
<input type="hidden" name="postthread" value="1" />
<input type="hidden" name="forums" value="all" />
<input type="hidden" name="showresults" value="threads" />
<input type="text" name="keywords" value="search..." onfocus="if(this.value == 'search...') { this.value = ''; }" onblur="if(this.value=='') { this.value='search...'; }" size="22" />
<input type="submit" value="Go" class="search-button" title="Search the forums" />
</form>
</span>
<ul>
<li>Home</li>
<li>Tournaments</li>
</ul>
</div>
There is the complete code on how I have developed this. However, the problem is mainly in the CSS.
#header {
padding: 60px 0 85px;
height: 56px;
text-align: left;
position: relative;
}
#panel {
background: rgba(0,0,0,0.4);
color: #fff;
border: 1px solid #07090b;
border-radius: 6px;
position: absolute;
top:0;
margin-top: 0px;
right: 0;
padding-top: 4px;
font-size: 12px;
padding-right: 12px;
padding-left: 12px;
height: 130px;
}
.menu {
border-radius: 6px;
-webkit-border-radius: 6px;
border: 1px solid #174d7b!important;
height: 50px;
}
I can't find a way to fix the problem however, because there is no way to add position:relative; and make the navigation links still work as they are intended to.

Without actual link or a working snippet it would be hard to find the issue, but please try this css that may solve your problem:
.menu { width: 100%; }
.menu ul li a { display: inline-block; width: auto; float: left; }
Hope this helps

Related

HTML -webkit-center issue

I wrote some code and I realize there is an issue. When I use -webkit-center and write something in textbox, all items going to the right. I tried other -webkit align settings but there are no problem, just -webkit-center. I researched about it but I can't find anything. Can anyone explain why?
Here is the code you can also try.
<div id="mainDiv" style="text-align: -webkit-center; display: inline-grid; margin-left: 40%;border-style:double;">
<span>HEADER</span>
<input name="header" type="text" id="header" style="margin: 20px;width:173px;">
<span>CONTENT</span>
<input name="content" type="text" id="content" style="margin: 20px;height:50px;width:350px;">
<span>HEADER COLOR</span>
<input name="headColor" type="text" id="headColor" style="margin: 20px;width:173px;">
<span>CONTENT COLOR</span>
<input name="contColor" type="text" id="contColor" style="margin: 20px;width:173px;">
<input type="submit" name="button" value="SUBMIT" id="button" style="height: 30px;width:173px;margin:20px;">
</div>
-the webkit-center property works differently than the normal text-center property. Instead of aligning the content, block tries to sort the elements.
I got the same look by doing different styling. You can control it. for each input, you will need to type media query to be responsive because you give constant width values.
#mainDiv {
display: flex;
flex-direction: column;
align-items: center;
}
<div id="mainDiv" style=" text-align: center;width: 40%; margin:auto;border-style:double;">
<span>HEADER</span>
<input name="header" type="text" id="header" style="margin: 20px;width:173px;">
<span>CONTENT</span>
<input name="content" type="text" id="content" style="margin: 20px;height:50px;width:350px;">
<span>HEADER COLOR</span>
<input name="headColor" type="text" id="headColor" style="margin: 20px;width:173px;">
<span>CONTENT COLOR</span>
<input name="contColor" type="text" id="contColor" style="margin: 20px;width:173px;">
<input type="submit" name="button" value="SUBMIT" id="button" style="height: 30px;width:173px;margin:20px auto;">
</div>
Hi Göksel ÖZER
You could try to use the code below to experiment with some other features and HTML tags for this type of scenarios.This will include separating the inline style and include it in a tag in the head section of the HTML or if possible, save it in a separated CSS file to include it on the head of the html file as well for best practices.
I kindly invite you to start digging more about the fantastic world of CSS, Please have a look at this link for more information regarding this amazing world.
input[type=button], input[type=submit], input[type=reset] {
background-color: #9F9F9F;
border: 2px solid gray;
color: white;
padding: 0 10px;
text-decoration: none;
margin: 4px;
cursor: pointer;
}
#mainDiv {
text-align: center;
text-align: -moz-center;
text-align: -webkit-center;
display: inline-grid;
width:55%;
border-style:double;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -1%);
}
.header{
color:#A9A9A9 !important;
margin-bottom: 5px;
}
#button {
height:30px;
width:173px;
margin:20px;
}
textarea {
width:174px !important;
height:50px !important;
padding: 0;
border: 1px solid #ccc;
text-align: center;
text-align: -moz-center;
text-align: -webkit-center;
}
.myinputs {
height:20px;
line-height:20px;
width:173px;
text-align: center;
text-align: -moz-center;
text-align: -webkit-center;
}
<div id="mainDiv">
<h4 class="header">HEADER</h4>
<input name="header" type="text" id="header" class="myinputs">
<h4 class="header">CONTENT</h4>
<input name="content" type="text" id="content" class="myinputs">
<h4 class="header">HEADER COLOR</h4>
<input name="headColor" type="text" id="headColor" class="myinputs">
<h4 class="header">CONTENT COLOR</h4>
<textarea class="header">
</textarea>
<input type="submit" name="button" value="SUBMIT" id="button">
</div>

Nav bar with position: fixed not displaying properly?

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../css/example.css" rel="stylesheet" type="text/css" />
<title>My Portfolio</title>
</head>
<body>
<div class="nav">
<ul>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
<div class="content">
<p>Self-studying to become a web developer. Learning HTML, CSS, and JavaScript plus jQuery through Jon Duckett's books and FreeCodeCamp. Once I get my entry level job, I wish to study more and expand on back-end development, so I can become a full-stack developer.</p>
<p>Portfolio:</p>
<p>Contact me here:</p>
<input type="text" />
<br />
<input type="text" />
<br />
<input type="text" />
<br />
<input type="submit" value="Send" />
<p>Here's where you can get in touch with me! Here, you can request for my resume, get more details on my experience, or learn more about my favorite hobbies! I will reply as soon as I am able, thanks!
</div>
</body>
</html>
body {
margin: 0px;
background-color: rgba(195, 246, 255, 0.56);
}
.nav {
background-color: rgba(190, 190, 190, 0.72);
position: fixed;
left: 0px;
right: 0px;
text-align: center;
height: 100px;
border: 1px solid black;
}
li {
display: inline;
font-size: 20px;
}
.content {
border: 1px solid green;
background-color: white;
width: 1100px;
margin-top: 102px;
}
I'm trying to put a nav bar on top, with my content below it so it doesn't interfere. I set my .nav to height=100px and when I try to set my .content below it with margin-top: 102px, it ends up moving the .nav bar as well. However, when I add a border such as border: 1px solid black; to my body, it ends up working. I'm so confused! Can I make it so that without adding a border to my body, the nav displays correctly above my content?
position: fixed makes the element fixed to the page, so that it will always appear in exactly that position (with content either going on top or behind if necessary). If you'd like your navbar to be positioned at the top of the page, you're looking to apply top: 0 to it:
body {
margin: 0px;
background-color: rgba(195, 246, 255, 0.56);
}
.nav {
background-color: rgba(190, 190, 190, 0.72);
position: fixed;
left: 0px;
right: 0px;
top: 0;
text-align: center;
height: 100px;
border: 1px solid black;
}
li {
display: inline;
font-size: 20px;
}
.content {
border: 1px solid green;
background-color: white;
width: 1100px;
margin-top: 102px;
}
<body>
<div class="nav">
<ul>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
<div class="content">
<p>Self-studying to become a web developer. Learning HTML, CSS, and JavaScript plus jQuery through Jon Duckett's books and FreeCodeCamp. Once I get my entry level job, I wish to study more and expand on back-end development, so I can become a full-stack
developer.</p>
<p>Portfolio:</p>
<p>Contact me here:</p>
<input type="text" />
<br />
<input type="text" />
<br />
<input type="text" />
<br />
<input type="submit" value="Send" />
<p>Here's where you can get in touch with me! Here, you can request for my resume, get more details on my experience, or learn more about my favorite hobbies! I will reply as soon as I am able, thanks!
</div>
</body>
If you don't want it to obscure the content on scroll, you're looking for position: relative. You'll also probably want to remove the margin-top: 102px on .content:
body {
margin: 0px;
background-color: rgba(195, 246, 255, 0.56);
}
.nav {
background-color: rgba(190, 190, 190, 0.72);
position: relative;
left: 0px;
right: 0px;
top: 0;
text-align: center;
height: 100px;
border: 1px solid black;
}
li {
display: inline;
font-size: 20px;
}
.content {
border: 1px solid green;
background-color: white;
width: 1100px;
}
<body>
<div class="nav">
<ul>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
</ul>
</div>
<div class="content">
<p>Self-studying to become a web developer. Learning HTML, CSS, and JavaScript plus jQuery through Jon Duckett's books and FreeCodeCamp. Once I get my entry level job, I wish to study more and expand on back-end development, so I can become a full-stack
developer.</p>
<p>Portfolio:</p>
<p>Contact me here:</p>
<input type="text" />
<br />
<input type="text" />
<br />
<input type="text" />
<br />
<input type="submit" value="Send" />
<p>Here's where you can get in touch with me! Here, you can request for my resume, get more details on my experience, or learn more about my favorite hobbies! I will reply as soon as I am able, thanks!
</div>
</body>
Hope this helps! :)
You should set top: 0; to your .nav class otherwise it will try to preserve the existing position vertically which could be why the margin is managing to affect it.

Tab contents are not consuming space, so html tags defined later are not actually rendered after tab contents

I'm trying to build tabs using pure HTML and CSS. I've got the tab functionality working, so when you click a tab label the corresponding content shows.
But in my design I've 2 tab areas, 1 for request and 1 for response. For some reason my request seems to overlap the response area, why is this so?
The <hr> tag that separates the 2 areas should always be below the request area's shown content.
http://jsfiddle.net/bobbyrne01/pgzt6nbf/
Current output (content tab) ..
Current output (header tab) ..
Desired output ..
html ..
<div id="main">
<div class="left w60">
<div class="center">
<h2>Request</h2>
</div>
<div>
<div>
<input id="url" placeholder="Request URL .." class="w100" />
</div>
<br/>
<div>
<select id="method">
<option value="0">GET</option>
<option value="1">HEAD</option>
</select>
<button type="button" id="submit">Submit</button>
</div>
<br/>
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1a" name="tab-group-1" hidden checked />
<label class="tabLabel" for="tab-1a">Headers</label>
<div class="content">
<div id="headersRequest">
<table id="headersRequestTable" class="w100">
<tr>
<th>Name</th>
<th>Value</th>
<th>
<input type="button" id="newHeaderButton" value="+" />
</th>
</tr>
</table>
</div>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2a" name="tab-group-1" hidden checked />
<label class="tabLabel" for="tab-2a">Body content</label>
<div class="content">
<div id="bodyRequest">
<textarea id="bodyRequestListItem" rows="10" class="w100"></textarea>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="center">
<h2>Response</h2>
</div>
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1b" name="tab-group-2" hidden checked />
<label class="tabLabel" for="tab-1b">Headers</label>
<div class="content">
<div id="headers"></div>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2b" name="tab-group-2" hidden checked />
<label class="tabLabel" for="tab-2b">Body content</label>
<div class="content">
<button id="clipboard" style="display: none;">Copy to clipboard</button>
<br/>
<div id="bodyContent"></div>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3b" name="tab-group-2" hidden checked />
<label class="tabLabel" for="tab-3b" id="statusListItem">Status</label>
<div class="content">
<div id="status"></div>
</div>
</div>
</div>
</div>
<div class="right w30">
<div class="center">
<h2>History</h2>
<table id="historyContainer"></table>
</div>
</div>
</div>
css ..
.left {
float: left;
}
.right {
float: right;
}
.center {
text-align: center;
}
.w30 {
width: 30%;
}
.w40 {
width: 40%;
}
.w50 {
width: 50%;
}
.w60 {
width: 60%;
}
.w100 {
width: 100%;
}
.bCollapse {
border-collapse: collapse;
}
/*
* Tabs
*/
.tabs {
position: relative;
height: 100%;
clear: both;
margin: 35px 0 25px;
}
.tab {
float: left;
}
.tabLabel {
background: #eee;
padding: 10px;
border: 1px solid #ccc;
margin-left: -1px;
position: relative;
left: 1px;
top: -20px;
}
.content {
position: absolute;
top: 2px;
left: 0;
right: 0;
bottom: 0;
padding: 20px;
opacity: 0;
}
[type=radio]:checked ~ label {
background: white;
border-bottom: 1px solid white;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
opacity: 1;
}
Try to add min-height for tabs Demo
.tabs {
position: relative;
height: 100%;
min-height: 200px;
clear: both;
margin: 35px 0 25px;
display:block;
}
I remember a year or 2 back, before I learned JS, when I was heavily invested in creating functioning tabs using only HTML and CSS. They can be done, but at a cost of being unable to use animations on them (you cannot animate from display: none to display: block).
Anyway, the issue you are having if because your element with the class "content" has its position set to "absolute". By definition, you are telling this element to not consume space. Remove this, or change the position to "relative", and you should see a more desired behaviour.

Border at bottom of parallax website

Im having trouble getting rid of the border at the bottom of my website, www.goodlord.co. It is a single page scroller.
The last image is the problem I need to extend it to the end of the whole website but each time i do that the website its self extends. I would really appreciate any help.
Tom
This is the Style Sheet for the section css.
section{ background: #fff; }
body{ -webkit-font-smoothing: antialiased; #fefefe; }
#main-container{ overflow: hidden; }
input{ -webkit-appearance: none; }
input:focus{ outline: none; }
.nopad{ padding: 0px; }
.offix{ overflow: hidden; }
.pad-normal{ padding-top: 66px; padding-bottom: 34px; }
.pad-large{ padding-top: 60px; padding-bottom: 60px; }
.pad-end{ padding-top: 60px; padding-bottom: 60px; }
.pad-large-top{ padding-top: 99px; }
.pad-large-bottom{ padding-bottom: 99px; }
.pad-top{ padding-top: 66px; }
.pad-bottom{ padding-bottom: 66px; }
.space-top{ margin-top: 22px; }
.space-top-large{ margin-top: 44px; }
::selection {color:#fff;background:#444444;}
::-moz-selection {color:#fff;background:#444444;}
This is the index for the section.
<a id="contact-scroll"></a>
<section id="contact" class="text-divider bg-cover pad-end">
<img alt="Slider Background" class="divider-bg" src="img/estate.jpg" />
<div class="divider-overlay"></div>
<div class="row divider-content">
</div>
<div class="row divider-content">
<div class="medium-8 medium-centered columns">
<form id="contact-form" class="text-center">
<h1 class="text-white">Get in touch</h1>
<input id="form-name" type="text" placeholder="Name" />
<input id="form-email" type="text" placeholder="Email" />
<input id="form-msg" type="text" placeholder="Message" />
<div class="text-right">
<span id="details-error" class="text-white">*Error: Please complete all fields correctly</span>
<span id="form-sent" class="text-white">Thankyou, your enquiry has been sent!</span>
<div class="btn white-btn clear-btn"><h6 class="alt-h text-white">Clear</h6></div>
<div id="form-btn" class="btn white-btn"><h6 class="alt-h text-white">Send</h6></div>
</div>
</form>
</div>
</div>
Having a look, that last white border is actually padding, not border.
the final section with ID '#work' has the '.pad-large' class on it. remove it and the final image should butt up right to the bottom of the page.
You might need to restore the top padding of the item, as .pad-large adds 60px padding to the top and bottom of the item.

Search field isn't on same line as text

I'm trying to insert a search field in my header (black zone) but doesn't work. I want the search field inline with "SimpleCMS"...
See this screenshot to understand:
I want it on the same line as the header text...
There's my HTML code:
<div id="header"><h1><?php echo($header_text); ?></h1>
<div style="float: right;">
<form action="search.php" method="get">
<input type="text" name="q" id="q" value="Search..." />
<input type="submit" value="Search" />
</form>
</div>
</div>
And my CSS:
#header
{
padding: 5px 10px;
background: #000;
color: #FFF;
text-align: left;
}
The problem is that you use a <h1> element. This will span over the whole width (see here) of the top so that every other element will be placed below it. Use a <span> instead and style it according to your needs. Using position-absolute as alpaca lips nao suggests might work as well.
Update: Use position: absolute;
#header
{
padding: 5px 10px;
background: #000;
color: #FFF;
text-align: left;
position: relative;
}
#header div form {
position: absolute;
top: 75px;
right: 25px;
}