HTML/CSS css boxes and positioning -
i have css greybox: (when greybox, mean css box have created have made color grey can see down below.)
.navigation-div { margin-top: 14px; box-shadow: 0px 0px 10px rgba(0,0,0,0.47); padding: 0; color: #e3e3e3; background-color: #333; }
this greybox inside of header , since greybox bigger appears, goes past header image doesn't appear.
with this:
<div class="navigation-bar"> <a class="navigation-div-blur"> <div class="navigation-div"> <nav class="navigation"> <a href="mailto:info@email.com"><img id="mailpicture" src="images/gmail.png"></a> <h1 id="mailtext">mail us</h1> <h1 id="nava">test</h1> </nav> </div> </a> </div>
the picture , mail show in correct position not exposing box. test however, when put in exposes box. here css have behind this
#mailtext { margin-top: 20px; display: inline-block; margin-left: 1230px; font-size: 20px; color: white; font-style: italic; } #mailpicture { display: inline-block; margin-top: 16px; float: right; } #nava { font-size: 20px; color: white; font-weight: bold; font-style: italic; margin-top: 20px; display: inline-block; margin-left: 500px; }
you saw box css.
i accomplish either 1 of 2 things: make css box smaller , lower it, or have css correctly position test along more elements stay in same line mail us.
note: have tried test margin-top:-pixels, not go high enough , stops going after while.
this looks test: looks without test:
as can notice first 1 has larger box drops down beneath header picture. 1 without test has stayed in header's picture.
there few problems code. first, should not nest anchors (<a>
) in other anchor elements. using margin position elements not idea, trying use inline-block
change default block
display of headers , @ same time floating 1 of inline-block
elements right.
adding big margin element makes element use more space , moves next inline element new line if cannot fit in 1 line other elements.
if want position menu items right can use text- align:right
on inline-block
elements stick them right.
if want mail element on right may stick using float:right
on it, easier place mail element last 1 in nav
you can nest anchors <a>
inside headers <h1>
create links inside headers
<h1 id="mailtext">mail <a href="mailto:info@email.com"><img id="mailpicture" src="images/gmail.png"></a></h1>
http://jsbin.com/kazocekoba/1/
.navigation-div { margin-top: 14px; box-shadow: 0px 0px 10px rgba(0,0,0,0.47); padding: 0; color: #e3e3e3; background-color: #333; text-align: right; } #mailtext { margin-top: 20px; display: inline-block; /* margin-left: 1230px;*/ font-size: 20px; color: white; font-style: italic; } #mailpicture { display: inline-block; margin-top: 16px; float: right; } #nava { font-size: 20px; color: white; font-weight: bold; font-style: italic; margin-top: 20px; display: inline-block; /*margin-left: 500px;*/ } /* use padding separate navigation elements */ .navigation > * { padding-left: 2em; }
<div class="navigation-bar"> <a class="navigation-div-blur"> <div class="navigation-div"> <nav class="navigation"> <!-- --><a href="mailto:info@email.com"><img id="mailpicture" src="images/gmail.png"></a> <h1 id="mailtext">mail us</h1> <h1 id="nava">test</h1> </nav> </div> </a> </div>
a bit better solution http://jsbin.com/xunokaviju/1/
.navigation-div { margin-top: 14px; box-shadow: 0px 0px 10px rgba(0,0,0,0.47); padding: 0; color: #e3e3e3; background-color: #333; text-align: right; } #mailtext { margin-top: 20px; display: inline-block; /* margin-left: 1230px;*/ font-size: 20px; color: white; font-style: italic; } #mailpicture { display: inline-block; margin-top: 16px; /*float: right;*/ } #nava { font-size: 20px; color: white; font-weight: bold; font-style: italic; margin-top: 20px; display: inline-block; /*margin-left: 500px;*/ } /* use padding pad elements */ .navigation > * { padding-left: 1em; }
<div class="navigation-bar"> <a class="navigation-div-blur"> <div class="navigation-div"> <nav class="navigation"> <!-- --> <h1 id="nava">test</h1> <h1 id="mailtext">mail <a href="mailto:info@email.com"> <img id="mailpicture" src="images/gmail.png"></a> </h1> </nav> </div> </a> </div>
Comments
Post a Comment