tags:

views:

67

answers:

3

How would I have a top right corner div as shown in the image. I want to do something similar though not exactly the same. I think the text is not an image.

alt text

Also, I have seen some websites that has a page hover effect when a mouse is over the top right section. Any idea how to do that?

A: 

I'm assuming you want fixed positioning.

#Element {
   position: fixed;
   top:0;
   right:0;
}
KThompson
+1  A: 
div.topRight {
    position: absolute;
    top: 0%;
    right: 0%;
}

This will assign a division with class set as 'topRight' to the top right corner. I'm sure you can figure out how to get the image to show up properly from that. Make sure you set the proper width and height on it. As for hovering, what exact effects do you want? You can modify the CSS on hover easily, if that's all you want to do.

div.topRight:hover {
    // new css rules
}
animuson
@animuson - I don't think the text "Take our survey" is an image. It's text.
+2  A: 

If the text isn't an image, none of the other answers will work. Here is some css that rotates a div 45 degrees and works in IE + FF + Webkit.

#yourdiv
{
    top: 0px;
    right: 0px;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
     transform: rotate(45deg);
     filter: progid:DXImageTransform.Microsoft.Matrix(M11='0.7071067811865476', M12='-0.7071067811865475', M21='0.7071067811865475', M22='0.7071067811865476', sizingMethod='auto expand');
}
Jud Stephenson
It's better to just make it an image rather than use W3C-unapproved styles. He'll have to use an image for the background anyways. Might as well throw the text on it.
animuson
For a top right "flag" like that, an image would be better. I actually used that code in an app that required the text to be dynamic.
Jud Stephenson
@Jud - Just wanted to confirm - This works on major browsers (IE, FF, Safari, Chrome?)
I haven't extensively tested, and it may require some modification for your purposes, BUT: IE, FF, Safari, and Chrome are represented in the css above (`-webkit`, `-moz`, and `transform` for wishful thinking). The `filter` uses a proprietary IE transformation that should even work in IE6.
Jud Stephenson
@Jud - FWIW, this doesn't work with FF. Although it tilts the text by 45 degrees, it places it in the top right corner with half of the text hidden beneath the browser's toolbar
hmm, it works in FF with the css I had in production. I would try setting a width and height for `#yourdiv` and also centering the text, which should correct that issue. Hopefully this got your started and you can play around with it until it works.
Jud Stephenson
You can set the point where you want the element to be rotated relative to with the css: `transform-origin: left top;`. (You should probably test which corner is the right one). Also, to get it to work with slightly earlier versions of Opera, you should add `-o-transform: ...`.
mqchen