Nic727 Posted December 8, 2014 Share Posted December 8, 2014 (edited) Hi, I have a problem with my logo position : I want it more on the top to be centered with my name. I tried margin-bottom and padding-bottom, but it doesn't work. Thank you for your help My code : <div class="logo"><img src="img/logo2.png" width="30px" alt="logo" /></div> <span class="light">Name</span> Last Name .logo{float: left;margin-right: 10px;cursor: pointer;} Edited December 8, 2014 by Nic727 Link to comment Share on other sites More sharing options...
davej Posted December 8, 2014 Share Posted December 8, 2014 I think you need to include a little more code. For example is this inside another div or is it alone at the top of the page? Link to comment Share on other sites More sharing options...
Ingolme Posted December 8, 2014 Share Posted December 8, 2014 Because it's floated you can't move it relative to the line of text. Try having the image inside the same element as the text is. You can even remove the float: left part, it won't be necessary. <img id="logo" src="img/logo2.png" width="30px" alt="logo" /> <span class="light">Name</span> Last Name#logo { vertical-align: middle;} Vertical-align can take numeric values as well, if you want to be specific with the vertical positioning of the image relative to the text that's next to it. Link to comment Share on other sites More sharing options...
Nic727 Posted December 9, 2014 Author Share Posted December 9, 2014 Because it's floated you can't move it relative to the line of text. Try having the image inside the same element as the text is. You can even remove the float: left part, it won't be necessary. <img id="logo" src="img/logo2.png" width="30px" alt="logo" /> <span class="light">Name</span> Last Name#logo { vertical-align: middle;}Vertical-align can take numeric values as well, if you want to be specific with the vertical positioning of the image relative to the text that's next to it. Thank you, I just put a <div> to regroup the logo and the text and it worked with your code.Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now