Forum Moderators: open

Message Too Old, No Replies

layers at 45degree angle to the page

         

humpingdan

4:08 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



what i would like to bae able to do is position, for example a square layer:

#DIV {
width: 100px;
height: 100px;
background: #000;
left: 50px;
top: 50px;
{

but for the output to be a diamond, so its a square layer just on an angle to make it ppear as i diamond!

any ideas?

DrDoc

5:12 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure it can be done, but it's tricky...

Take a look at Eric Meyer's "slantastic" demos for one way of accomplishing it, or, do something like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Slanted page</title>
<style type="text/css">
body {
background-color: #000;
}
#diamond {
background-color: #fff;
position: absolute;
top: 10px;
left: 10px;
border-left: 200px solid #000;
border-right: 200px solid #000;
border-bottom: 400px solid #fff;
width: 400px;
height: 1px;
font-size: 1px;
}
#text {
position: absolute;
top: 20px;
left: 10px;
width: 800px;
text-align: center;
}
#text span {
margin-bottom: .2em;
display: block;
}
</style>
</head>
<body>
<div id="diamond"></div>
<div id="text">
<span style="font-size: 10px;">a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y</span>
<span style="font-size: 10px;">z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z</span>
<span style="font-size: 11px;">a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y</span>
<span style="font-size: 11px;">z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z</span>
<span style="font-size: 11px;">a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c</span>
<span style="font-size: 12px;">d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f</span>
<span style="font-size: 12px;">g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k</span>
<span style="font-size: 12px;">l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q</span>
<span style="font-size: 13px;">r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x</span>
<span style="font-size: 13px;">y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f</span>
<span style="font-size: 14px;">g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h</span>
<span style="font-size: 14px;">i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l</span>
<span style="font-size: 14px;">m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p q</span>
<span style="font-size: 16px;">r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x</span>
<span style="font-size: 16px;">y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g</span>
<span style="font-size: 17px;">h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m</span>
<span style="font-size: 18px;">n o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n</span>
<span style="font-size: 18px;">o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p</span>
<span style="font-size: 19px;">q r s t u v x y z a b c d e f g h i j k l m n o p q r s t u v x y z a b c d e f g h i j k l m n o p q r s</span>
</div>

</body>
</html>

mipapage

5:15 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool stuff Dr.Doc,

I was thinking that he wanted the actual layer rotated, contents too, is this (above) what you meant humpingdan?

If so, sorry to steer you here!

DrDoc

5:17 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aah, that makes sense, mipapage ;)
When re-reading the post I think that's what was meant too :)

Hmm, let's see if anything else can be dug up...

[edited by: DrDoc at 5:17 pm (utc) on Dec. 17, 2003]

humpingdan

5:17 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



sorry didnt mean to mislead you there in CSS forum,
yeah just wanted to purely slant my layer, cheers anyway!
and you Doc!

DrDoc

5:18 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So, now that I'm confused... :)

Did you want it slanted (as in the example I posted), or rotated?

mipapage

5:19 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you want it slanted <snip>, or rotated?

Wedges, and supersize it... (hahaha)!
couldnt resist :}

krieves

6:09 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



IE will let you rotate an object using the rotate filter. I've never used it, but if you're not concerned with cross-browser compatibility, it's something to look into.

humpingdan

8:17 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



looks like ive confused everyone!

i want to be able to place text and images in a div an then them look randomly placed on the page!

like theyve just been thrown down on to the page, but i want the entire contents and the layer to appear ion this way!

got it?

DrDoc

3:58 am on Dec 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



got it...

So, you want something like

···/\···
··//\\··
·///\\\·
////\\\\
\\\\////
·\\\///·
··\\//··
···\/···

not

·····____·····
····///\\\····
···////\\\\···
··/////\\\\\··
·//////\\\\\\·
·ŻŻŻŻŻŻŻŻŻŻŻŻ·

Purple Martin

6:30 am on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The quick answer: No. Sorry dude but it can't be done with JavaScript.

DrDoc

8:11 am on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I beg to differ: [google.com...]

There are ways... You would just have to find out what suits your needs the best. Cross browser compatibility is going to be a huge issue, as well as flexibility. Especially since text is involved...

humpingdan

9:13 am on Dec 19, 2003 (gmt 0)

10+ Year Member



can of worms me thinks!

Purple Martin

6:22 am on Dec 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DrDoc, I checked out the first 5 links on that search to see if any of them use pure JavaScript to rotate content. As I suspected, none of them did:

1. Uses the IE filter
2. Uses an SVG method
3. Uses the DirectX Structured Graphic Control (SCG)
4. Not about rotating (it's about switching between divs)
5. Changes the coordinates of straight lines, circular arcs and sinus waves. It doesn't rotate normal content.

I know I'm being pedantic here by ruling out those other things as non-JavaScript, but I still say that JavaScript can't rotate content.

Of course some of those things found by your search could be really useful to humpingdan (if cross browser problems are within acceptable limits), and I learned a few things too, so thanks for the link ;)

TheDoctor

1:24 pm on Dec 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And it's only possible to rotate an image or other graphical object.

To rotate text, a browser would have to convert the text into graphics first before rotating it (remember, it's the browser that does the work - JavaScript only gives it commands). No browser does this at the moment, AFAIK. Somebody please correct me if I'm wrong.

Of course, given that programs do exist that convert text into graphics, there may be a server-side solution.