I first just wanted to add custom menus to my wordpress site..!
I did add those but right now..There is some white space above the menus...which I want to remove that..But I am not really getting what to do?
Here is my Menu code :
<nav id="primaryNav" section="brandnav" data-endpoint="/component/load/xhr/">
<ul>
<li class="menu double" id="reviewsMenu" data-component="touchMenuHover">
<a class="menuHead" data-trigger="menu" href="reviews/index.html">Reviews</a>
</li>
<li class="menu double" id="newsMenu" data-component="touchMenuHover">
<a class="menuHead" data-trigger="menu" href="news/index.html">News</a>
</li>
<li class="menu double" id="videoMenu" data-component="touchMenuHover">
<a class="menuHead" data-trigger="menu" href="videos/index.html">Video</a>
</li>
<li class="menu single" id="howtoMenu" data-component="touchMenuHover">
<a class="menuHead" data-trigger="menu" href="how-to/index.html">How To</a>
</li>
<li class="menu" id="download">
<a class="menuHead" href="http://www.download.com/" data-user-action="legacy">Download</a>
</li>
</ul>
</nav>
also CSS code for menus is this :
li:hover {
height:59px;
}
#primary {
height: 59px;
font-size: 0.94118em;
position: relative;
background-color: #6895d9;
min-width: 980px;
}
#primary .menuWrapper {
font-size: 14px;
position: absolute;
top: 74px;
left: 0;
z-index: 5000000;
box-shadow: 0 3px 8px 3px rgba(0, 0, 0, 0.1);
background-color: #fff;
opacity: 0;
visibility: hidden;
-webkit-transition: opacity 0.2s ease, top 0.2s ease;
-moz-transition: opacity 0.2s ease, top 0.2s ease;
-o-transition: opacity 0.2s ease, top 0.2s ease;
transition: opacity 0.2s ease, top 0.2s ease;
}
#primary .menuWrapper a {
color: #768696;
display: block;
}
#primary .menuWrapper a:hover {
color: #ff8b00;
}
#primary .menuWrapper:after {
position: absolute;
content: "";
display: block;
background: url('http://cnet4.cbsistatic.com/fly/339-fly/bundles/cnetcss/images/sprites/main-s58cd57e9cc.png') 0 -1341px no-repeat;
left: 30px;
padding-top: 0;
top: -5px;
height: 5px;
width: 11px;
}
#primary .single nav {
padding-right: 10px;
float: left;
}
#primary .single nav:after {
background-color: #DBDBDB;
box-shadow: 2px 0 3px -3px rgba(0, 0, 0, 0.4) inset;
content: "";
display: block;
height: 100%;
right: 0;
position: absolute;
top: 0;
width: 10px;
}
#primary .double nav {
overflow: hidden;
}
#primary .double .navWrapper {
background: #DBDBDB;
box-shadow: 2px 0 3px -3px rgba(0, 0, 0, 0.4) inset;
float: left;
left: 180px;
position: relative;
width: 450px;
}
#primary .hed {
text-transform: uppercase;
margin-top: 0;
font-weight: 600;
}
#primaryNav a.menuHead {
color: #fff;
position: relative;
height: 59px;
line-height: 59px;
display: block;
}
#primaryNav .menu {
float: left;
position: relative;
padding: 0 20px;
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
.searchBar {
border-radius: 18px;
position: relative;
}
.searchBar input {
font-size: 16px;
background: none;
border: none;
width: 85%;
margin-left: 15px;
height: 30px;
padding-bottom: 0;
}
.searchBar button {
height: 15px;
width: 14px;
position: absolute;
top: 8px;
right: 15px;
border: none;
background: url('http://cnet4.cbsistatic.com/fly/339-fly/bundles/cnetcss/images/sprites/main-s58cd57e9cc.png') 0 -1158px no-repeat;
}
.searchBar {
box-shadow: 0 4px 3px -3px rgba(0, 0, 0, 0.25) inset;
background-color: #ECECEC;
border: 1px solid #D9D9D9;
}
and live site link " http://www.huntedhunter.com/teqvibez/
so if you people can help please to determine that what is causing this white space to appear and how to remove that..?
waiting for your reply...!
EDIT:
redo: #primaryNav .menu { float:left};
add: #primaryNav {float:left};
Works for me!
Related
Problem
I drew 2 overlapping figures with CSS.
Because it is translucent, overlapping parts stand out.
I want to make it translucent like this when hovering, but can we do something like synthesize figures?
(I also mind that the end of transition of two figures is different..)
What I tried
I thought that the overlapping part could be deleted with overflow: hidden;, but it was not applicable to the & :: before element which diagonal cut part got lost.
Central placement problem
I would like to centrally align the letters in the tabs in this way.
Code
html { font-size: 62.5%; }
body { background-color: #c6d2dd; }
header { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; font: inherit; vertical-align: baseline; background: transparent; box-sizing: border-box; } /* reset */
header ul {
list-style: none;
display: flex;
align-items: center;
flex-wrap: wrap;
overflow: hidden;
width: 100%;
margin-bottom: -1px;
}
header li {
font-size: 1.5rem;
height: 4.5rem;
padding-left: .4rem;
}
header li:first-child {
padding-left: 1.5rem;
}
header li:last-child {
padding-right: .5rem;
}
header li > a {
text-decoration: none;
display: block;
padding: 1rem 2rem;
height: 100%;
color: #fff;
outline: none;
transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
position: relative;
border-radius: 9px 5px 0 0;
}
/* from here */
header li > a:hover { /* The rectangular part on the right side */
background-color: rgba(255, 255, 255, 0.4);
border-color: rgba(255, 255, 255, 0.4);
transition: background-color 0.3s ease-in, border-color 0.3s ease-in;
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
}
header li > a:hover::before { /* Part of oblique cut on the left side */
background-color: rgba(255, 255, 255, 0.4);
border-color: rgba(255, 255, 255, 0.4);
transition: background-color 0.3s ease-in, border-color 0.3s ease-in;
box-shadow: -2px 2px 2px rgba(0, 0, 0, 0.2);
}
header li > a::before { /* Part of oblique cut on the left side */
content: '';
position: absolute;
z-index: 1;
top: 0;
left: -.4rem;
bottom: 0;
width: 1rem;
transition: background-color 0.3s ease-in;
transform: skew(-15deg);
border-radius: 5px 0 0 0;
}
.current a { /* add from here */
border: 1px solid #fff;
border-bottom-width: 0;
z-index: 3;
background-color: #9bacbb;
pointer-events: none;
margin-bottom: -3px;
}
.current a::before {
border: 1px solid #fff;
background-color: #9bacbb;
margin: -1px 0 -3px -1px;
z-index: 3;
left: -.5rem;
}
.current a::after {
content: '';
position: absolute;
z-index: 3;
top: 0;
left: -.4rem;
bottom: 0;
width: 1rem;
transform: skew(-15deg);
border-radius: 5px 0 0 0;
margin-bottom: -3px;
background-color: #9bacbb;
}
.content {
display: flex;
margin: 0 1rem 1rem 1rem;
width: 100vw;
height: 61.9rem;
position: relative;
background: #9bacbb;
border: 1px solid #fff;
border-radius: 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, 0.5);
}
<header>
<nav>
<ul>
<li class="111">
<a href="#">
111
</a>
</li>
<li class="222">
<a href="#">
222
</a>
</li>
<li class="333">
<a href="#">
333
</a>
</li>
<li class="444">
<a href="#">
444
</a>
</li>
<li class="current">
<a href="#">
555
</a>
</li>
</ul>
</nav>
</header>
<div class="content"> <!-- add -->
Hello world
</div>
I would do this differently with only one element. The trick is to have the skew and hide the overflowing part on the right:
check comment on the code
html { font-size: 62.5%; }
body { background-color: #c6d2dd; }
header { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; font: inherit; vertical-align: baseline; background: transparent; box-sizing: border-box; } /* reset */
header ul {
list-style: none;
display: flex;
align-items: center;
flex-wrap: wrap;
overflow: hidden;
width: 100%;
margin-bottom: -1px;
}
header li {
font-size: 1.5rem;
height: 4.5rem;
padding-left: .4rem;
}
header li:first-child {
padding-left: 1.5rem;
}
header li:last-child {
padding-right: .5rem;
}
header li > a {
text-decoration: none;
display: block;
padding: 1rem 1rem 1rem 3rem; /*changed the padding*/
margin-left:-2rem; /*create the overlap*/
height: 100%;
color: #fff;
outline: none;
transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
position: relative;
border-radius: 9px 5px 0 0;
overflow:hidden; /*hide the overflow*/
/*increase the z-index*/
position:relative;
z-index:2;
}
/* from here */
header li > a:hover { /* The rectangular part on the right side */
transition: background-color 0.3s ease-in, border-color 0.3s ease-in;
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
/*remove border and background from here*/
}
header li > a:hover::before { /* Part of oblique cut on the left side */
background-color: rgba(255, 255, 255, 0.4);
border-color: rgba(255, 255, 255, 0.4);
transition: background-color 0.3s ease-in, border-color 0.3s ease-in;
box-shadow: -2px 2px 2px rgba(0, 0, 0, 0.2);
}
header li > a::before { /* Part of oblique cut on the left side */
content: '';
position: absolute;
z-index: -1;
top: 0;
left: 0;
bottom: 0;
right:0; /*make right:0*/
transition: background-color 0.3s ease-in;
transform: skew(-15deg);
transform-origin:bottom right; /*change the origin*/
border-radius: 5px 0 0 0;
}
.current a {
pointer-events: none;
margin-bottom: -3px;
border-right: 1px solid #fff;
}
.current a::before {
border: 1px solid #fff;
background-color: #9bacbb;
}
.content {
display: flex;
margin: 0 1rem 1rem 1rem;
width: 100vw;
height: 61.9rem;
position: relative;
background: #9bacbb;
border: 1px solid #fff;
border-radius: 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, 0.5);
}
<header>
<nav>
<ul>
<li class="111">
<a href="#">
111
</a>
</li>
<li class="222">
<a href="#">
222
</a>
</li>
<li class="333">
<a href="#">
333
</a>
</li>
<li class="444">
<a href="#">
444
</a>
</li>
<li class="current">
<a href="#">
555
</a>
</li>
</ul>
</nav>
</header>
<div class="content"> <!-- add -->
Hello world
</div>
I was under the impression that if an element has a set height & width of 0, padding wouldn't push the width/height if the box-sizing is also set to border box, the thing is, this does seem to be the case, but as soon as I add a 1px solid border, the padding gets applied.
div#search > form#sform > a { display: inline-block; width: 20%; }
input#q { width: 80%; display: inline-block; border: 0px; }
div#search > form#sform > a { display: inline; width: 20%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70' style='width:100%;height:100%' viewBox='0 0 70 70'%3E%3Cg class='base'%3E%3Cg fill='none' fill-rule='evenodd' class='main-fill'%3E%3Cpath d='M33.765 17.294C26.725 17.294 21 23.02 21 30.06c0 7.04 5.725 12.765 12.765 12.765 1.876 0 3.657-.416 5.263-1.146l6.266 9.793c.383.663.871 1.235 1.647 1.235 1.202 0 2.059-.818 2.059-2.059.007-.347-.225-.911-.412-1.235l-6.305-9.857a12.726 12.726 0 0 0 4.246-9.496c0-7.04-5.724-12.765-12.764-12.765zm0 1.647c6.15 0 11.117 4.968 11.117 11.118s-4.967 11.117-11.117 11.117A11.105 11.105 0 0 1 22.647 30.06c0-6.15 4.968-11.118 11.118-11.118z' class='main-fill'/%3E%3C/g%3E%3C/g%3E%3Cstyle%3E.main-fill%7Bfill:%23fff%7D%3C/style%3E%3C/svg%3E"); padding: 13px 10%; background-repeat: no-repeat; background-color: #a03f6e; -webkit-background-size: 50px 50px; -moz-background-size: 50px; -o-background-size: 50px; background-size: 50px; background-position: center center; margin: 0px; height: 40px; position: relative; top: 10px; left: 0px; }
div#search { position: absolute; top: 125px; left: 0; right: 0; margin: auto; width: 100%; max-width: 1200px; z-index: 15; background-color: white; height: 40px; }
div#search:focus, div#search:focus-within { outline: 1px solid #dadada; }
div#search input#q { width: 80%; display: inline; border: 0px; height: 40px; padding-left: 6px; float: left; height: 0px; width: 0px; padding: 0px; padding-left: 10px; border-bottom: 1px solid #aaa; font-size: 20px; font-family: 'Montserrat'; text-align: center; -webkit-box-shadow: inset 0 0 20px 20px white; -moz-box-shadow: inset 0 0 20px 20px white; box-shadow: inset 0 0 20px 20px white; -webkit-transition: 0.2s all ease-in; -o-transition: 0.2s all ease-in; -moz-transition: 0.2s all ease-in; transition: 0.2s all ease-in; }
div#search input#q:focus { outline-offset: 1px; }
input#q:focus { font-weight: 600; color: #444; -webkit-transition: 0.2s all ease-in; -o-transition: 0.2s all ease-in; -moz-transition: 0.2s all ease-in; transition: 0.2s all ease-in; }
div#search input#q::-webkit-input-placeholder { font-size: 14px; }
div#search input#q:-moz-placeholder { font-size: 14px; }
div#search input#q::-moz-placeholder { font-size: 14px; }
div#search input#q:-ms-input-placeholder { font-size: 14px; }
div#search input#q::-ms-input-placeholder { font-size: 14px; }
div#search input#q::placeholder { font-size: 14px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="search">
<form action="#" method="get" id="sform" name="sform">
<input id="q" type="text" placeholder="Search...">
<a onclick="if ($('#search input#q').val().length > 3) {document.sform.submit()}else if($('input#q').width() == 0){$('#search input').height('40px').animate({width:'80%'},350);}else{$('#search input').focus();}" rel="nofollow"></a>
</form>
</div>
Tick the border-bottom on/off on the input and watch the padding be applied/unapplied
Am I going crazy or is this what should happen? I mean, personally I'd think it'd be the other way round, padding enables border.
Also if it helps, Chrome 68 Win10.
Details
I have made a div navigator for my website, there are 4 menu buttons which float left, and 1 authentication button which floats right. The navigators position is relative so it doesn't move.
CODE
body {
background-color: #2B2B2B;
}
.main {
position: relative;
top: 0%;
left: 0%;
right: 0%;
width: 101.6%;
height: 10%;
z-index: 1;
min-height: 120px;
max-height: 120px;
background-color: rgba(26, 26, 26, 0.9);
}
.logo {
display: block;
float: left;
top: 0%;
left: 0%;
right: 0%;
/*background-image: url('images/logo.png');
width: 150px;
height: 155px;*/
font-size: 32pt;
color: white;
margin-top: 3%;
margin-left: 1%;
}
.menu {
display: inline-block;
position: relative;
top: 0%;
left: 0%;
right: 0%;
background-color: rgba(26, 26, 26, 0.9);
height: 100%;
width: 101%;
border-style: solid;
border-color: rgba(26, 26, 26, 0.9);
border-radius: 0%;
z-index: 1;
max-height: 7%;
max-width: 102.5%;
min-height: 50px;
min-width: 100%;
overflow: hidden;
}
.Button1 {
display: block;
font-size: 10pt;
float: left;
right: 15%;
left: 30%;
top: 0%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
padding: 25px 2px 55px 2px;
vertical-align: center;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button1:hover {
color: #C90205;
}
.Button2 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 10%;
white-space: nowrap;
color: white;
width: 7%;
margin-top: 0%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
vertical-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button2:hover {
color: #C90205;
}
.Button3 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button3:hover {
color: #C90205;
}
.Button4 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button4:hover {
color: #C90205;
}
.Button5 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button5:hover {
color: #C90205;
}
.Button6 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 8%;
white-space: nowrap;
color: white;
margin-top: 0%;
font-family: sans-serif;
height: 10%;
width: 7%;
text-align: center;
height: 10%;
text-align: center;
padding: 28px 0px 55px 0px;
text-align: center;
line-height: 2px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
;
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
}
.Button6:hover {
color: #C90205;
}
.signin {
float: right;
width: 114px;
height: 42px;
margin-top: 0.5%;
margin-right: 1.9%;
color: red;
}
.mainpage {
height: 100%;
width: 80%;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%
}
<div class="main">
<a class="logo" href="/" style="text-decoration:none">My Website</a>
</div>
<div class="menu">
<a class="Button1" href="/" style="text-decoration:none">Button 1</a>
<a class="Button2" href="/" style="text-decoration:none">Button 2</a>
<a class="Button3" href="/" style="text-decoration:none">Button 3</a>
<a class="Button4" href="/" style="text-decoration:none">Button 4</a>
<a class="Button5" href="/support" style="text-decoration:none">Button 5</a>
<a class="Button5" href="/" style="text-decoration:none">Button 6</a>
<a class="signin" href="/login" style="text-decoration:none">AuthButton</a>
</div>
<div class="mainpage"></div>
<!-- This is page under the navigator for placing the content, right now it's empty -->
Fiddle.
Problem
Unfortunately if you look at this, and try to scroll horizontally you will see the overflow and it would just stay there, even though when I had the bottom content container mainpage div with the height of 100% and width of 80%, it would still be able to scroll down when there's nothing there at all.
As you see this code below, I have tried to limit html and body with specific resolution, which didn't fix my problem.
html, body {margin:0;padding:0;height:100%;width:100%}
Question
How could i limit my page from being scrolled in specific resolution only?
Can resolution be greater than value of 100% so it can work?
your problem is here:
.main {
width: 101.6%;
}
.mainpage {
height: 100%;
width: 80%;
}
I tweaked your code merging all those buttons classes into one. you had invalid/unused properties there.
you need to fix those properties mentioned above like this:
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body {
margin: 0;
height: 100%;
background-color: #2B2B2B
}
.main {
position: relative;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 10%;
min-height: 120px;
max-height: 120px;
background-color: rgba(26, 26, 26, 0.9)
}
.logo {
float: left;
top: 0;
left: 0;
right: 0;
/*background-image: url('images/logo.png');
width: 150px;
height: 155px;*/
font-size: 32pt;
color: white;
margin: 3% 0 0 1%
}
.menu {
display: inline-block;
position: relative;
top: 0;
left: 0;
right: 0;
background-color: rgba(26, 26, 26, 0.9);
border: solid rgba(26, 26, 26, 0.9);
border-radius: 0;
z-index: 1;
min-height: 50px;
min-width: 100%
}
.Button {
font-size: 10pt;
float: left;
font-family: sans-serif;
padding: 25px 2px 55px;
border: solid rgba(0, 0, 0, 0.25);
border-width: 0 1px;
white-space: nowrap;
color: white;
width: 7%;
text-align: center;
line-height: 6px;
border-radius: 5px;
min-width: 70px;
transition: 0.1s ease-in;
text-decoration: none
}
.Button:hover {
color: #C90205;
}
.signin {
float: right;
width: 114px;
height: 42px;
margin-top: 0.5%;
margin-right: 1.9%;
color: red;
}
.mainpage {
height: calc(100% - 216px);
width: 100%;
}
<div class="main">
<a class="logo" href="/" style="text-decoration:none">My Website</a>
</div>
<div class="menu">
<a class="Button b1" href="/">Button 1</a>
<a class="Button b2" href="/">Button 2</a>
<a class="Button b3" href="/">Button 3</a>
<a class="Button b4" href="/">Button 4</a>
<a class="Button b5" href="/support">Button 5</a>
<a class="Button b6" href="/">Button 6</a>
<a class="signin" href="/login">AuthButton</a>
</div>
<div class="mainpage"></div>
<!-- This is page under the navigator for placing the content, right now it's empty -->
Another approach with smaller CSS can be seen here: https://jsfiddle.net/3125ygjf/3/
Perhaps you should also have a look at the flexbox-model. There you don't have to care about the absolute positioning. The container gets display: flex; flex-direction: column;and than you can place the header, menu and main in there. You just have give the main-div the needed hight and make it scrollable. That's it.
*edit: In addition all your buttons have a width of 7% i.e. This will cause trouble later on when you change the text for example. Try to avoid such width-values.
There are several things wrong in your code, I will list as many as I could notice:
div elements by default are 100% width, so you do not need to specify it. If you are trying to make some sort of hack using more than 100% because it is not fitting the whole x-axis of your viewport, something is wrong with your code.
A class serves as a multiple selector, meaning that you can just use one class for all your buttons if they all share the same CSS properties.
If you are defining max-height and min-height with the same value, why not just use height.
body has a margin by default in different browsers, generally it is around 8px, so you can remove it by using margin: 0.
Your main css property should always come after your vendor prefixes such as -webkit-, -moz-, etc.
When you use zero in your css properties, there is no need to specify px, pt, % or any other unit, since 0 will always be computed as 0px.
JSFiddle
CODE SNIPPET:
body {
background-color: #2B2B2B;
margin: 0
}
.main {
position: relative;
height: 10%;
z-index: 1;
height: 120px;
background-color: rgba(26, 26, 26, 0.9);
}
.logo {
display: block;
float: left;
/*background-image: url('images/logo.png');
width: 150px;
height: 155px;*/
font-size: 32pt;
color: white;
margin-top: 3%;
margin-left: 1%;
}
.menu {
position: relative;
background-color: rgba(26, 26, 26, 0.9);
height: 100%;
border-style: solid;
border-color: rgba(26, 26, 26, 0.9);
border-radius: 0;
z-index: 1;
height: 50px;
overflow: hidden;
}
.btn {
font-size: 10pt;
white-space: nowrap;
color: white;
float: left;
margin-top: 0;
width: 7%;
font-family: sans-serif;
padding: 25px 0 55px 0;
vertical-align: center;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 70px;
-o-transition: 0.1s ease-in;
-ms-transition: 0.1s ease-in;
-moz-transition: 0.1s ease-in;
-webkit-transition: 0.1s ease-in;
transition: 0.1s ease-in;
}
.btn:hover {
color: #C90205;
}
.signin {
float: right;
width: 114px;
height: 42px;
margin-top: 0.5%;
margin-right: 1.9%;
color: red;
}
.mainpage {
height: 100%;
}
<div class="main">
<a class="logo" href="/" style="text-decoration:none">My Website</a>
</div>
<div class="menu">
<a class="btn" href="/" style="text-decoration:none">Button 1</a>
<a class="btn" href="/" style="text-decoration:none">Button 2</a>
<a class="btn" href="/" style="text-decoration:none">Button 3</a>
<a class="btn" href="/" style="text-decoration:none">Button 4</a>
<a class="btn" href="/support" style="text-decoration:none">Button 5</a>
<a class="btn" href="/" style="text-decoration:none">Button 6</a>
<a class="signin" href="/login" style="text-decoration:none">AuthButton</a>
</div>
<div class="mainpage"></div>
<!-- This is page under the navigator for placing the content, right now it's empty -->
I am trying to create a DP box for the user which is containing a user profile picture in it, where on image hover an edit profile image link will appear, but it is not working. When I hover over on the image it is blinking and the link doesn't appear correctly.
Here is the codepan link click here
#import url(https://fonts.googleapis.com/css?family=Roboto);
body {
font-family: 'Roboto', sans-serif;
background-color: #eee;
}
.dp {
width: 128px;
height: 128px;
margin: 0 auto;
border-radius: 50%;
border: 4px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.52);
overflow: hidden;
position: relative;
}
.edit-dp a {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
line-height: 130px;
background-color: rgba(0, 0, 0, .9);
text-align: center;
transition: all .2s ease-in-out;
color: #fff;
font-size: 15px;
text-decoration: none;
display: none;
}
.dp img:hover ~ .edit-dp a {
display: block;
}
<div class="dp">
<img src="http://rs618.pbsrc.com/albums/tt265/davejarrett/Avatars/check-in-minion_zps7ee060ac.jpg~c200" alt="" width="128">
<div class="edit-dp">
Edit Image
</div>
</div>
The blinking glitch is because of that :hover effect of display: block on image instead of container div.
Since every time you :hover on the image you ultimately gonna edit it, so instead of display: none you can set it to opacity: 0 and on :hover you can set it to opacity: 1 and by doing this you'll get a nice transition effect too.
Here's the Snippet for a better view:
#import url(https://fonts.googleapis.com/css?family=Roboto);
body {
font-family: 'Roboto', sans-serif;
background-color: #eee;
}
.dp {
width: 128px;
height: 128px;
margin: 0 auto;
border-radius: 50%;
border: 4px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.52);
overflow: hidden;
position: relative;
}
.edit-dp a {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
line-height: 130px;
background-color: rgba(0, 0, 0, .9);
text-align: center;
color: #fff;
font-size: 15px;
text-decoration: none;
opacity: 0;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.dp:hover .edit-dp a {
opacity: 1;
}
<div class="dp">
<img src="http://rs618.pbsrc.com/albums/tt265/davejarrett/Avatars/check-in-minion_zps7ee060ac.jpg~c200" alt="" width="128">
<div class="edit-dp">
Edit Image
</div>
</div>
Solution 1:
Use following css will make your effect nice.
.dp:hover > .edit-dp a{
display: block;
}
Make hover effect on div instead of image
#import url(https://fonts.googleapis.com/css?family=Roboto);
body {
font-family: 'Roboto', sans-serif;
background-color: #eee;
}
.dp {
width: 128px;
height: 128px;
margin: 0 auto;
border-radius: 50%;
border: 4px solid #fff;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.52);
overflow: hidden;
position: relative;
}
.edit-dp a {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
line-height: 130px;
background-color: rgba(0, 0, 0, .9);
text-align: center;
transition: all .2s ease-in-out;
color: #fff;
font-size: 15px;
text-decoration: none;
display: none;
}
.dp:hover > .edit-dp a{
display: block;
}
<div class="dp">
<img src="http://rs618.pbsrc.com/albums/tt265/davejarrett/Avatars/check-in-minion_zps7ee060ac.jpg~c200" alt="" width="128">
<div class="edit-dp">
Edit Image
</div>
</div>
Working Codepen
Solution 2:
And Another solution is use pointer-events:none; on hover.
.dp img:hover ~ .edit-dp a{
display: block;
pointer-events:none;
}
Working Codepen
Can anyone help me with wrapping of the text around the + box ? I can't seem to get it to work. I have a jfiddle that you can refer to. Hope anyone out there can assist me.
Here's the JSFiddle.
And here is the code:
.video-box {
float: left;
width: 31%;
max-width: 240px;
height: 214px;
background: #232323;
margin: 0 1% 2%;
}
.video-box h3 {
display: table-cell;
vertical-align: middle;
margin: 0;
font-size: 1.0em;
line-height: 1.2;
}
.addtoplaylist-videotext:before {
border: solid;
border-color: #222 transparent;
border-width: 6px 6px 0 6px;
bottom: -8px;
content: "";
left: 80%;
position: absolute;
display: inline-block;
z-index: 99;
border-top: 10px solid rgba(0, 0, 0, 0.6);
}
a {
color: #FFFFFF;
}
.video-txt {
position: absolute;
bottom: 0;
right: 0;
font-size: 1.1em;
line-height: 16px;
background: #000;
padding: 0 3px;
color: #fff;
}
.addtoplaylist-videotext {
background-color: #ffffff;
background-color: rgba(0, 0, 0, 0.6);
border-color: rgba(0, 0, 0, 0.6);
border-right-color: #ffffff;
border-radius: 5px;
top: -50px;
color: #ffffff;
left: -100px;
padding: 5px 5px;
position: relative;
z-index: 99;
width: 120px;
height: 15px;
text-align: center;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#1e78a0', endColorstr='#1e78a0');
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
cursor: pointer;
display: none;
}
.viewplaylist-videotext:before {
border: solid;
border-color: #222 transparent;
border-width: 6px 6px 0 6px;
bottom: -8px;
content: "";
left: 80%;
position: absolute;
display: inline-block;
z-index: 99;
border-top: 10px solid rgba(0, 0, 0, 0.6);
}
.viewplaylist-videotext {
background-color: #ffffff;
background-color: rgba(0, 0, 0, 0.6);
border-color: rgba(0, 0, 0, 0.6);
border-right-color: #ffffff;
border-radius: 5px;
top: -50px;
color: #ffffff;
left: -100px;
padding: 5px 5px;
position: relative;
z-index: 99;
width: 120px;
height: 15px;
text-align: center;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#1e78a0', endColorstr='#1e78a0');
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
cursor: pointer;
display: none;
}
.addtoplaylist-video:hover .addtoplaylist-videotext {
display: block;
}
.viewplaylist-video:hover .viewplaylist-videotext {
display: none;
}
.title {
color: #FFFFFF;
}
.maintainhere-browse {
float: right;
height: 30px;
margin-left: 3px;
margin-top: 20px;
position: relative;
}
.toggle2 {
position: relative;
float: right;
margin-right: 10px;
margin-top: -15px;
background-color: #f36666;
width: 20px;
height: 18px;
color: #FFFFFF;
font-size: 12px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
cursor: pointer;
font-weight: bold;
}
.addtoplaylist-video {
position: relative;
bottom: 0px;
right: 0px;
width: auto;
height: auto;
image-rendering: -moz-crisp-edges;
display: inline-block;
cursor: pointer;
}
.viewplaylist-video {
display: none;
}
}
.addtoplaylist-video a {
color: #FFFFFF !important;
}
.viewplaylist-video a {
color: #FFFFFF !important;
}
.play-ico {
background-position: -2px -1351px;
background: url(/blob/1086/1386905708000/a-ico-sprite-png-data.png) no-repeat -2px -1316px;
text-indent: -9999px;
position: absolute;
top: 0;
left: 0;
width: 33px;
height: 33px;
overflow: hidden;
text-align: left;
}
<div class="video-box">
<div class="video-box-content-holder" data-createtime="1385208101000" data-viewcounts="559">
<div class="img" style="max-height:135px">
<a href="/news/video/typhoon-haiyan-politics/897416.html">
<img src="http://i58.tinypic.com/2uj2o3t.jpg" alt="" width="240" height="135" />
<span class="play-ico">play</span>
<span class="video-txt">01:54</span>
</a>
<span class="add-txt">Asia Pacific</span>
</a>
</div>
<div class="txt-box">
<!-- the class toggle 2 is for 2nd component, diff css-->
<div class="maintainhere-browse">
<div id="browsevideos_1" class="toggle2">
<div class="addtoplaylist-video">
<img src="http://i61.tinypic.com/rtdv2b.png" width="12" height="11" alt="add" class="addplaylisticonimg-browse">
<span class="addtoplaylist-videotext"> Add To Playlist!</span>
</div>
<div class="viewplaylist-video">
<img src="http://i59.tinypic.com/2n98as.png" width="17" height="9" alt="viewicon" class="viewplaylisticonimg-browse">
<span class="viewplaylist-videotext"> View Playlist!</span>
</div>
</div>
</div>
<!--endofmaintainhere-->
<div class="title">
<h3 style="color:white;">Typhoon Haiyan: Politics gets in the way of saving lives i want the text to wrap around </h3>
<span class="date" style="color:white;">23 Nov 2013</span>
</div>
<!-- title -->
</div>
</div>
</div>
So the basic problem is assigning display: table to .video-box h3.
Once that is removed, it actually does wrap. The problem is now that you won't see it with that text, because it so happens that those words would move to the next line anyway. I've added more words and removed the height of the container and you can see this working:
DEMO showing text is wrapping without table-cell property.
In your case, I'd consider rewriting some of the code around positioning the .maintainhere-browse button:
.maintainhere-browse{
...
/*margin-top:20px; Remove this line */
...
}
.toggle2 {
...
margin-top: 10px; /* Changed this value */
...
}
Demo