Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Effect of bottom view for a text using CSS

Tags:

css

Whether it is possible tilt, rotate, shrink 3d text? I want to create an effect of bottom view on my text (or if text lies on a table) using only CSS. Is it possible? I do not mean the animation, only static effect. I can do it in the 3dsMAX or PhotoShop, but I want to know how it can be implemented in CSS.

I have:

Fiddle

enter image description here

I want:

enter image description here

I got a little bit this effect (due to the large shadow). But I want to make it more clear and explicit. Further increase in the shade does not enhance the effect. I need to tilt and compress vertically my text. What styles can help me in this?

I would be grateful for any ideas!

My shadow styles:

text-shadow: 0px 0px 0 rgb(221,120,128),
             -1px 1px 0 rgb(215,114,122),
             -2px 2px 0   rgb(209,108,116),
             -3px 3px 0 rgb(203,102,110),
             -4px 4px 0 rgb(197,96,104),
             -5px 5px 0 rgb(191,90,98),
             -6px 6px 0 rgb(185,84,92),
             -7px 7px 0 rgb(178,77,85),
             -8px 8px 0 rgb(172,71,79),
             -9px 9px 0 rgb(166,65,73),
             -10px 10px 0 rgb(160,59,67),
             -11px 11px 0 rgb(154,53,61),
             -12px 12px 0 rgb(148,47,55),
             -13px 13px 0 rgb(142,41,49),
             -14px 14px 0 rgb(136,35,43),
             -15px 15px 0 rgb(130,29,37),
             -16px 16px 15px rgba(0,0,0,0.6),
             -16px 16px 1px rgba(0,0,0,0.5),
             0px 0px 15px rgba(0,0,0,.2);

}

like image 321
François Esthète Avatar asked Mar 12 '14 14:03

François Esthète


People also ask

What is the use of bottom property in HTML?

Definition and Usage. The bottom property affects the vertical position of a positioned element. This property has no effect on non-positioned elements. If position: absolute; or position: fixed; - the bottom property sets the bottom edge of an element to a unit above/below the bottom edge of its nearest positioned ancestor. If position:...

What is text-reveal effect using HTML and CSS?

How to create text-reveal effect using HTML and CSS ? Text-reveal is a type of effect in which all the alphabets of the text are revealed one by one in some animated way. There are uncountable ways to animate text for this effect.

What are the properties of CSS text effects?

Many properties of CSS text effects help to provide various styling in the words of a sentence in an HTML page with CSS.So that words will get the various pattern, orientations, and designs by using various text effects of the CSS.

What is text overflow in CSS?

CSS Text Overflow. The CSS text-overflow property specifies how overflowed content that is not displayed should be signaled to the user. It can be clipped: This is some long text that will not fit in the box.


2 Answers

that is not easy i think you will need js for that,unfortunately css text-shadow property is only 2 dimensional. Here is a quick example, use your keyboard to controll the angle

0- REAL 3D USING ONLY CSS cross browser compatibility solution(prefixfree)

For Cross-browser gradients (NO -webkit-,-moz-,-ms-)

save your time using LeaVerou/prefixfree

you can find a CDN Version here

3D DEMO with prefixfree & CSS only

figure {
  transform-origin:center center;
  transform-style:preserve-3d;
  transform: rotate3d(-1,0,0,-72deg);
}

enter image description here

1- REAL 3D USING JQUERY cross browser compatibility solution(prefixfree)

3D DEMO with Jquery

MARKUP

<figure></figure>

JS

var shadowLength = 40;
for(var i = 0;i < shadowLength; i++){
    var layer = $("<h1>3D TEXT</h1>").css("transform", "translateZ(-"+i+"px)");
    $("figure").append(layer);
}

CSS

* { box-sizing:border-box; }

:root{
  background-color: #00dbba;
  overflow:hidden;
  text-align:center;
}

figure {
  transform-origin:center center;
  transform-style:preserve-3d;
  transform: rotate3d(-1,0,0,-72deg);
}

h1:first-child{
    color:white;
}
h1 {
  display:block;
  width:100%;
  padding:40px;
  line-height:1.5;
  font:900 8em 'Concert One', sans-serif;
  text-transform:uppercase;
  position:absolute;
  color:#51B3A3;
}

you can now choose the position by changing the value of rotateZ(Value deg) rotateX(Value deg) rotateY(Value deg) to get the perfect position.

figure {
  transform-origin:center center;
  transform-style:preserve-3d;
  transform: rotateZ(0deg) rotateX(70deg) rotateY(-12deg);
}

enter image description here

deep understanding css3D

Read how Nesting 3D Transformed Elements Works

and don't miss [CSSconf.eu 2013] Ana-Maria Tudor: Maths-powered transforms for creating 3D shapes

if you need more, read

1- css-3d-animation-how

2- Ana-Maria Tudor on stackoverflow

2- REAL 3D

3D DEMO with animation

figure#figure3d {
  -webkit-transform: rotateX(54deg) scale(1) skew(10deg) translate3d(0px, 0px, 0px);
  -webkit-transform-origin:center center;
  -webkit-transform-style:preserve-3d;
}

enter image description here

you can remove the span if you don't like the animation at the beginning

span{
   display:none;/*comment me to remove the animation*/
}

3- IN GENERAL

3D DEMO with animation

or change the angle like this

-webkit-transform:rotate3d(-1,1,0,40deg);

3D DEMO without animation

#figure3d span {
color:silver;
    -webkit-text-shadow: 0px 1px 0px #c0c0c0, 0px 2px 0px #b0b0b0, 0px 3px 0px #a0a0a0, 0px 4px 0px #909090, 0px 5px 10px rgba(0, 0, 0, 0.6);
    -moz-text-shadow: 0px 1px 0px #c0c0c0, 0px 2px 0px #b0b0b0, 0px 3px 0px #a0a0a0, 0px 4px 0px #909090, 0px 5px 10px rgba(0, 0, 0, 0.6);
    -ms-text-shadow: 0px 1px 0px #c0c0c0, 0px 2px 0px #b0b0b0, 0px 3px 0px #a0a0a0, 0px 4px 0px #909090, 0px 5px 10px rgba(0, 0, 0, 0.6);
     text-shadow: 0px 1px 0px #c0c0c0, 0px 2px 0px #b0b0b0, 0px 3px 0px #a0a0a0, 0px 4px 0px #909090, 0px 5px 10px rgba(0, 0, 0, 0.6);

  }

* { -webkit-box-sizing:border-box; }


figure#figure3d {
  -webkit-transform: rotate(0deg) scale(1) skew(0deg) translate3d(0px, 0px, 0px);
  -webkit-transform-origin:center center;
  -webkit-transform-style:preserve-3d;
}

4- USING ONLY CSS

the max you can do using text-shadow only ist something like this

#figure3d {
-webkit-transform: rotateX(65deg) scale(1) skew(10deg) translate3d(0px, 0px, 0px);
-webkit-transform-origin: center center;
-webkit-transform-style: preserve-3d;
font-size:3.6em;
  letter-spacing:10px;
  font-family: 'Alfa Slab One', cursive;
font-weight:900;
    color:white;
text-shadow: -1px 1px 0 #51B3A3, 
    -2px 2px 0 #51B3A3, 
    -2px 3px 0 #51B3A3, 
    -2px 5px 0 #51B3A3,
    -2px 7px 0 #51B3A3,
    -2px 8px 0 #51B3A3,
    -2px 10px 0 #51B3A3,
    -2px 11px 0 #51B3A3,
    -3px 13px 0 #51B3A3,
    -3px 14px 0 #51B3A3,
    -3px 16px 0 #51B3A3,
    -3px 17px 0 #51B3A3,
    -4px 19px 0 #51B3A3,
    -4px 20px 0 #51B3A3,
    -4px 22px 0 #51B3A3,
    -4px 23px 0 #51B3A3,
    -4px 25px 0 #51B3A3,
    -4px 26px 0 #51B3A3,
    -5px 28px 0 #51B3A3,
    -5px 29px 0 #51B3A3;
}

enter image description here

3D DEMO with text-shadow only

you can then ajust it as you like!

like image 139
Gildas.Tambo Avatar answered Sep 24 '22 09:09

Gildas.Tambo


I think this is what you're referring to (Fiddle). The transform selector is going to be your friend in this situation, i.e. transform: rotate(6.5deg) rotateX(188deg) skewX(-25deg).

HTML:

<div id="wrapper" contenteditable="true" spellcheck="false">
  <p>Where</p>
  <p>are the</p>
  <p>trees</p>
</div>

CSS:

@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:bold);

/* Global ------------------------------------------------------ */

html {
  height: 100%;
  font: 62.5%/1 "Lucida Sans Unicode","Lucida Grande",Verdana,Arial,Helvetica,sans-serif;
  background: url(http://s.cdpn.io/79/glow.png) no-repeat center center,
    url(http://s.cdpn.io/79/tilt-shift.jpg) no-repeat center center;
  background-size: auto, cover;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  background-color: hsla(30,20%,95%,.9);
}


/* Wrapper ------------------------------------------------------ */

#wrapper {
  position: relative;
  text-align: center;
  font-weight: bold;
  font-family: "Yanone Kaffeesatz", "Lucida Grande", Lucida, Verdana, sans-serif;
  margin: 0 auto;
  width: 600px;
  padding: 7em 0;
  background: url(http://s.cdpn.io/79/tilt-shift.jpg) no-repeat center center;
  border-radius: 4px;
  box-shadow: inset 0 -1px 0  hsla(0,0%,0%,.2), 0 21px 8px -12px rgba(0,0,0,.2);
  perspective: 350;
}

#wrapper:focus {
  outline: none;
}


#wrapper p {
  font-size: 10em;
  margin: 0;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-shadow: rgba(0,0,0,0.1) 0 20px 80px;
  -webkit-transition: -webkit-transform .1s ease-in; /* only WebKit because of performance */
}


/* Hover ------------------------------------------------------ */

#wrapper:hover p {
  color: hsla(0,0%,0%,0);
  transform: rotate(6.5deg) rotateX(28deg) skewX(-4deg);
  -webkit-transition: -webkit-transform .1s ease-out; /* only WebKit because of performance */
}

#wrapper:hover p:nth-child(1) {
  font-size: 9em;
  text-shadow: #fff 0 0 10px, 
    #fff 0 4px 3px, #ddd 0 9px 3px,  #ccc 0 12px 1px, 
    rgba(0,0,0,0.2) 0 14px 5px, rgba(0,0,0,0.1) 0 20px 10px,
    rgba(0,0,100,0.2) 0 15px 80px;
  text-indent: 0.3em;
}

#wrapper:hover p:nth-child(2) {
  font-size: 10em;
  text-shadow: #fff 0 0 1px, 
    #eee 0 4px 3px, #ddd 0 9px 3px,  #ccc 0 12px 1px, 
    rgba(0,0,0,0.2) 0 14px 3px, rgba(0,0,0,0.1) 0 20px 10px,
    rgba(0,0,100,0.2) 0 15px 80px;
}

#wrapper:hover p:nth-child(3) {
  font-size: 11em;
  text-shadow: #fff 0 0 2px, 
    #fff 0 4px 5px, #ddd 0 9px 5px,  #ccc 0 12px 10px, 
    rgba(0,0,0,0.2) 0 14px 5px, rgba(0,0,0,0.1) 0 20px 10px,
    rgba(0,0,100,0.2) 0 15px 80px;
}


/* Middle ------------------------------------------------------ */

#wrapper p:nth-child(2):hover {
  text-shadow: #fff 0 -5px 1px, 
    #eee 0 -1px 3px, #ddd 0 4px 3px,  #ccc 0 7px 1px, 
    rgba(0,0,0,0.2) 0 15px 5px, rgba(0,0,0,0.1) 0 20px 10px,
    rgba(0,0,0,0.2) 0 15px 80px;
}

#wrapper p:nth-child(2):active {
  text-shadow: rgba(0,0,0,0.2) 0 14px 5px, rgba(0,0,0,0.1) 0 20px 10px,
    rgba(0,0,0,0.2) 0 15px 80px;
}

#wrapper p::selection {
  background-color: red;
}
like image 42
eclipsis Avatar answered Sep 25 '22 09:09

eclipsis