I am trying to horizontally center a fixed and rotated div (orange square). The div should be sticked to the navigation bar and should be responsive. I have tried for a long time but I can't seem to find the right solution. The code I have at the moment is provided below.
Hopefully some of you have the right answer. Thank you in advance!
(P.s. I just joined stackoverflow and everything is still new to me. :P )
HTML:
<!DOCTYPE html>
<html>
<head>
<title>My test website!</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<section id="nav">
<div class="navbar"> <!-- Navbar Section -->
<ul id="navcontent">
<li><a href="#" class="active">Home</a></li>
<li><a href="#about">About</a></li>
<a href="#" class="navbarlogo"><img src="img/logo001.png" width="auto" height="40px" alt="Logo"/></a>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a>
</ul>
<div id="navsquare">
<div>
<div class="navsquare"></div>
</div>
</div>
</div>
</section>
<section id="header"> <!-- Header Section -->
<div class="header">
<img src="img/photo002.jpeg" width="100%" height="650" alt="Header image"/>
</div>
</section>
CSS:
#nav {
z-index: 30;
position: fixed;
}
#header {
z-index: 10;
position: relative;
height: 650px;
}
.navbar {
background-color: #fb7507;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 63px;
text-align: center;
box-shadow: 0px 5px 50px #222;
}
#navcontent {
display: inline-block;
list-style-type: none;
margin: 0px 0px 0px 40px;
padding: 0;
text-align: center;
}
.navsquare {
height: 115px;
width: 115px;
background-color: #fb7507;
border-radius: 5px;
-ms-transform: rotate(45deg); /* IE 9 */
-webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
transform: rotate(45deg);
box-shadow: 0px 5px 50px #222;
position: fixed;
left: 50%;
right: 50%
}
Screenshot: