May 4, 201016 yr Hi Please help me with this one: I have this code in my HTML: <div> <img src="logo.jpg" alt="logo" style="float:right; position:fixed; width:55%; height:55px; right:5px" /></div> This works well, it places my logo where I want it. But as I am now trying to tidy things up by putting all CSS in a separate CSS file, I modify the HTML code to this: <div id="logo"> <img src="logo.jpg" alt="logo"></div> And I place the CSS in the separate CSS file like this: #logo {float:right; position:fixed; width:55%; height:55px; right:5px} But if I do this, then my logo goes somewhere unrelated in the page (not the position I indicate it to). What am I doing wrong?
May 4, 201016 yr #logo {float:right; position:fixed; width:55%; height:55px; right:5px} your missing a semi colon on the end of your css: right:5px
May 4, 201016 yr your missing the closing / in the img html you posted It's a self-closing tag, and is fine. your missing a semi colon on the end of your css: right:5px Equally, not a problem. It's the last attribute so it doesn't need a semi-colon. Looking at your CSS, you want the logo to be at the top right hand corner of the page regardless of where you are scrolling. I suppose the question I have for this is, is the % for 'width' intentional? <div id="logo"></div> #logo { position:fixed; width:55px; height:55px; right:5px; top:5px; background-image:url(path/to/image); background-position:top right; background-repeat:no-repeat; } Regardless of where you are on the page, this will offset your logo from the top right hand corner by five pixels top and right. Could you put up a demo of this template, and an explanation of where you would rather the logo should go?
Create an account or sign in to comment