I can't move the logo on my website - html

I've been writing this website for a few days now and have gotten into trouble with my logo position. I can't seem to move it not matter how much I try. Can anyone suggest how I can do this? PS. (I'm still learning css.)
HTML:
<div class="logofx">
<img src="images\logo.png">
</div>
CSS:
.logofx img {
top:300px;
left:50px;
-webkit-transition: all 5s ease;
-moz-transition: all 5s ease;
-o-transition: all 5s ease;
-ms-transition: all 5s ease;
transition: all 5s ease;
}
.logofx img:hover {
-webkit-filter: hue-rotate(333deg);
}

You need position:relative, position:absolute or position:fixed (depending on the specific desired effect*).
By default, elements have position:static and statically-positioned elements are unaffected by left/top/right/bottom adjustments.
*Effects:
position:relative moves the element by the amount specified, but other elements behave like it hasn't moved. If you want other elements to move too, consider using margin properties instead.
position:absolute moves the element to be placed relative to the nearest position:relative container (or the whole document, if there is none).
position:fixed fixes the element in the browser window, using the left/top as coordinates.

Set position: fixed
.logofx img {
position: fixed;
top:300px;
left:50px;
-webkit-transition: all 5s ease;
-moz-transition: all 5s ease;
-o-transition: all 5s ease;
-ms-transition: all 5s ease;
transition: all 5s ease;
}

what about margins instead?
.logofx img {
margin:300px 0 0 50px;
display:block;
-webkit-transition: all 5s ease;
-moz-transition: all 5s ease;
-o-transition: all 5s ease;
-ms-transition: all 5s ease;
transition: all 5s ease;
}

HTMl:
<div class="logo"><div class="logofx">
<img src="images\logo.png">
</div>
</div>
CSS:
.logo{position:relative;}
.logofx{position:absolute; top:10px; left:10px;}
Try this code this will help you .Kindly put the top and left at correct pixel or move where you want using top and left property.

Related

Unexpected animation in CSS [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am working on a static website and have some animations in CSS:
*
{
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
This is fine and everything and every page is animated in the same way except one of my HTML documents which also contains input elements and a textarea:
<form action="script/contact-form.php" method="post">
<b>Full name:</b><br/>
<input type="text" name="name" /><br/>
<b>Subject:</b><br>
<input type="text" name="subject" /><br/>
<b>E-mail:</b><br>
<input type="text" name="email" />
<br/><br/>
<b>Your comments:</b><br/>
<textarea name="comment"></textarea>
<br/><br/>
<input type="submit" value="Submit" />
</form>
For some reason the entire page is then animated (unlike the other pages, which are using the same stylesheet). I tried disabling this with:
form, input, textarea
{
-moz-transition: none;
-webkit-transition: none;
-o-transition: color 0 ease-in-out;
-ms-transition: color 0 ease-in-out;
transition: none;
}
but it doesn't seem to have any effect. Here is what it looks like: http://notrussian.de/stack/contact-us.html. Clicking on other pages without the form has different effects.
This is starting to drive me nuts and I really hope you guys could help me out.
Thanks in advance.
What is going wrong
You say :
For some reason the entire page is then animated
That's the expected behaviour when you use this code :
* {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
The CSS selector * means that any CSS properties for that selector are applied to every element on your web page.
The value all for property transition means that every property of those elements that can be animated will be animated.
So, the combination of CSS selector * and CSS property transition: all means that every property that can be animated will be animated for every HTML element on your web page.
Solution 1 : Animate ONLY what you want to animate
You could do something like this :
/** Get rid of this code
* * {
* -webkit-transition: all 1s ease-in-out;
* -moz-transition: all 1s ease-in-out;
* -o-transition: all 1s ease-in-out;
* -ms-transition: all 1s ease-in-out;
* transition: all 1s ease-in-out;
* }
*/
.animate, .animate * {
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
Then, in your HTML, add class=animate to every element you want to animate :
<ul class="animate">
...
</ul>
There are many alternative implementations, but this is one of the easiest ones. For the best approach, see "Additional improvements" herebelow.
Solution 2 : Disable animation for what you DON'T want to animate
This should work :
form, input, textarea {
-moz-transition: none;
-webkit-transition: none;
-o-transition: color 0 ease-in-out;
-ms-transition: color 0 ease-in-out;
transition: none;
}
You say you tried it, but I can't find it anywhere in your code when I go to the page you referenced. Anyway, make sure you put it BEHIND the * selector.
Additional improvements
For the sake of performance AND to prevent unexpected behavior, it's best to always set animation ONLY for those properties and those elements you really want to animate.
So, if you want to animate both the width and height of your div elements, you should do something like this :
div {
-moz-transition: width 2s, height 4s;
-webkit-transition: width 2s, height 4s;
-o-transition: width 2s, height 4s;
-ms-transition: width 2s, height 4s;
transition: width 2s, height 4s;
}
If you want to animate just the background of your #navigation li elements, you should do something like this :
#navigation li {
-moz-transition: background 1s ease-in-out;
-webkit-transition: background 1s ease-in-out;
-o-transition: background 1s ease-in-out;
-ms-transition: background 1s ease-in-out;
transition: background 1s ease-in-out;
}

i have issue in css with transition it can't move smoothly in menu bar?

i have issue in CSS it can't move smoothly in menu bar, the menu in this link can anyone help me thanks .
here is the link jsfiddle.
i try this but nothing work :
.div-move{
-webkit-transition: width 1s ease-in-out;
-moz-transition: width 1s ease-in-out;
-o-transition: width 1s ease-in-out;
transition: width 1s ease-in-out;
}
You can't transition to width:auto, but by using max-width is automatically with use the size of your text. Just make sure the :hover width is longer then the text you use so it will all appear. Also I suggest using a transition on both hover and regular classes so you also have a transition when you mouse off the menu. Try changing these classes:
.text-header-move{
max-width: 0px;
float: right;
overflow: hidden;
-webkit-transition: max-width 1s ease-in-out;
-moz-transition: max-width 1s ease-in-out;
-o-transition: max-width 1s ease-in-out;
transition: max-width 1s ease-in-out;
}
.notification-bar:hover .text-header-move{
max-width:400px;
-webkit-transition: max-width 1s ease-in-out;
-moz-transition: max-width 1s ease-in-out;
-o-transition: max-width 1s ease-in-out;
transition: max-width 1s ease-in-out;
}
You want to transform to an "auto" value that was one of the problems.
.notification-bar:hover .text-header-move{
width:auto;
}
Take a look at this fiddle:
http://jsfiddle.net/herrfischerhamburg/jok48kpz/2/
I updated the fiddle to work with a "max-width", i think this is the better solution for you than the fixed width.

Trigger CSS animations by hovering over a seperate element

I'm attempting to create a small animation on an image (the image grows slightly) when a link is hovered over using only CSS3 animations.
The relevant snippets from my code
HTML:
<img id="enterimg" src="img.png" alt="" />
<a id="enterbutton" href="home.php">Enter</a>
CSS:
#enterimg {
width: 350px;
height: 350px;
-webkit-transition: width 1s ease-out, height 1s ease-out;
-moz-transition: width 1s ease-out, height 1s ease-out;
-o-transition: width 1s ease-out, height 1s ease-out;
transition: width 1s ease-out, height 1s ease-out;
}
a:hover ~ #enterimg{width:400px;height:400px;}
I'm sure the transitions themselves are correct, but none of the different "calls" (the last line of CSS) I've tried have worked.
(This is similar to a number of other questions, but I've looked through them and as far as I can tell none of them answer my question)
Thanks to Lokesh Suthar.
The order of the sibling selector required I placed the link first in the markup. Since the selection was written:
a:hover ~ #enterimg{width:400px;height:400px;}
The markup needed to be in that order
<a id="enterbutton" href="home.php">Enter</a>
<img id="enterimg" src="img.png" alt="" />
If you wrap the content in the trigger, then position the content absolutely, you can achieve something similar to triggering a sibbling with CSS. At least it'll look and act that way.
HTML
<a href="">Click Me
<img id="enterimg" src="http://www.druglessdrs.com/wp-content/uploads/2012/07/google-logo-small.jpg" alt="" />
</a>
CSS
a img {
display:block;
position:absolute;
top:80px;
left:0;
border:solid 1px black;
-webkit-transition: width 1s ease-out, height 1s ease-out;
-moz-transition: width 1s ease-out, height 1s ease-out;
-o-transition: width 1s ease-out, height 1s ease-out;
transition: width 1s ease-out, height 1s ease-out;
}
a:hover img {
left:50px;
}
Fiddle

focus state return to normal on mobile browsers?

I am using .css to create a portfolio webpage for my art. I am using a floating box layout to display each piece of art separately with a .focus tag so when an image is clicked it expands, clicked again to return it to normal. The problem I am having is that the site works fine on desktops, but not on mobile devices (ipads). In the case of ipads (using safari), the .focus will work to expand an image, but I cannot return the image to its original state. With Safari on my desktop, the image will return to its normal state, but I have to click away from it to do so.
I would like to keep this site .css/html only if possible.
This is .css code from the relevant style sheet
vert1{
display:inline-block;
width:150px;
height:200px;
position:relative;
}
vert1 img{
width:auto%;
height:100%;
position:absolute;
z-index:1;
-webkit-transition: all 0s ease;
-moz-transition: all 0s ease;
-o-transition: all 0s ease;
-ms-transition: all 0s ease;
transition: all 0s ease;
}
vert1:focus{
}
vert1:focus img{
width: auto;
height: 80%;
position: fixed;
left: 20%;
top: 10%;
z-index: 25;
-webkit-transition: all 0s ease;
-moz-transition: all 0s ease;
-o-transition: all 0s ease;
-ms-transition: all 0s ease;
transition: all 0s ease;
}
and this is its implementation in html
<div class="img">
<vert1 tabindex="1"><img src="7woman.jpg"></vert1><br />
title/medium/size
</div>
here is a link to the site
www.kurtkindermann.com
and a link to the above code in action
www.kurtkindermann.com/mix.html
Thank you!

CSS Crossfade image

I have this code that works great. When I pass the mouse over the image it crossfades to another image.
What I want is: when I pass over the mouse the image crossfade and rest like this, I mean, make only 1 transition.
1)image 1
2)onmouseover image 2
3)onmouse out image 2
here my code:
<div id="crossfade">
<img class="bottom" src="images/site3/pasarela1.png" />
<img class="top" src="images/site3/pasarela2.png" />
</div>
here my css code:
#crossfade {
position:relative;
height:250px;
width:400px;
}
#crossfade img {
position:absolute;
left:0;
opacity: 1;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
-ms-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
#crossfade img.top:hover {
opacity:0;
}
From what I get is that you want the :hover state to "stick". Though it's not a pure CSS solution, a solid way to handle this is if you are using jquery's .addClass.
$('.yourimage').mouseover(function() { //hover over your image to trigger the event
$(this).addClass('yourAnimationClass'); //add the animation class to the image you hovered over
});