Draw a Curved text using CSS - css

I want to know how to draw a text like this style ( curved) using only CSS please help me

It isn't super straightforward, but I suppose it could be done. Take a look at this article: Set Text on a Circle. Not the exact same thing, but same idea. You'd need to do it per character or section of words to do it.
A potentially easier solution would be to use Javascript/jQuery. But I know this doesn't meet your CSS only requirement. Consider looking at ArcText.js as an option if you feel CSS isn't doable for you.
There is also a tool that does this for you: CSS Warp - CSS Text to Path Generator. This would match exactly what you want, and generate the code for you for various browsers. I've never used it before, but seems nearly fool-proof.
Here is an example using CSS Warp. I spent about 5 minutes. It gets you pretty close to what you want, and you can polish it up more. Then just use CSS to add the rest of the styling.

Related

Warping text using CSS

In CSS or SVG, is it possible to warp text so it looks like it is written on a sphere or looked at using a magnifier?
Something similar to this
I have been look over the internet but could not find any guides.
All of the comments telling that it can't be done are wrong. YES IT CAN BE DONE. Well, it's not easy but possible. Let's start from the beginning.
1. Don't even think about writing the code. You need a vector graphics software. I used Corel Draw to this project.
2. You need to create all text, apply all transformation, style each letter, add shadow, background or whatever you need.
This is a simple project I created. It's a fast draft, but you can style the text exactly as on your photo. You can easily make all letters in the middle bigger than the others.
(sorry it's not in English!)
3. Force Corel Draw or any other program to save svg with fonts not curves.
4. I analyzed the code and I see that each letter is saved separetly as a glyph:
<glyph horiz-adv-x="222" unicode="l"><path d="m63.876 0.23623l-2.504 715.49 87.971 0.33072 2.504-715.49-87.971-0.33072z"/></glyph>
Some other letters are saved as text and transformations are applied:
<text class="fil1 fnt0" x="1045" y="1269"><tspan rotate="335">L</tspan></text>
5. FULL CODE looks like this. It's long. I minified it a little bit.
FIDDLE: https://jsfiddle.net/ubw1rdq7/
SOLUTION 2 - MUCH EASIER
It's not fun if you have each letter saved separetly because the file may be huge. You can save your text as a curve and have only one path. This will behave like an image but you can inline the code into your html.
Here is a fiddle:
https://jsfiddle.net/wyfhfjo4/
In both cases all code is over 30kb in size and I made only simple transformations. i hope I gave you some idea how you can achieve desired effect. 99% of the project is to work in vector editing software like Corel Draw and apply all transformation to the text.
For any 3d transformation it's better to transform the text to curves as it will definitely be easier. As an output you will get a path not glyphs.
It is possible to do this using an feDisplacementMap in SVG, but this is currently bugged in current Chrome, so not very useful to you.

creating a round list in CSS (for a round menubar)

I am really hoping someone can help me. I am trying to create a round menubar in CSS and I've searched and searched for solutions but have found nothing. I know how to create round areas (by setting the radius), and I know how to create a simple straight line menu using <ul> & <li> but, as said, I want to create a round one.
there is a picture of something alike what I'd love to get working:
If anyone could help me on this I'd be so thoroughly grateful.
Closest things I know of are these:
http://www.cssplay.co.uk/menus/cssplay-round-and-round.html
http://codepen.io/tgrant54/pen/lBHwK
Is that what you're after?
This menu looks almost like Path's Button.
You can find the link to Path's Button here.
You just need to modify it a bit so the menu displayed in full sphere.
This isn't something you really want to be doing in pure CSS.
You may be able to make circle shapes with border-radius, but you're not actually making a circular object -- it's still a regular box shape as far as the browser is concerned, just with the corners rounded off. This has absolutely no bearing at all on your ability to do anything else to do with circles or curves in CSS.
Yes, it's possible to do something along the lines you're after, by putting every character into its own element, and styling each of them with a specific position, but that's going to be painful, inflexible, and difficult to work with. If you really want to do this, there's a code generator you could try out here, but I'd say you're barking up the wrong tree.
If you want to do this kind of thing properly, what you really need to be thinking about is doing it in graphical format, using either Canvas or SVG, plus plenty of javascript code.
I'd suggest looking into a JS library like Raphael for this; there are people who have tried similar things already using Raphael, which may help you -- see here, for example: Radial Pie Menu With Raphael JS
Hope that helps.

CSS Text Editing

Hey guys I have a question, I plan on making a website for a friend that wants a nice description about them, for in terms of design they want something like this:
dsdsdsds
sdsdsdsdsdsdsd
sdsdsdsdsdsdsdsdsds
sdsdsdsdsdsdsdsdsdsdsdsd
sdsdsdsdsdsdsdsdsdsdsdsdsd
sdsdsdsdsdsdsdsdsdsdsdd
sdsdsdsdsdsdsdsdsdsd
sdsdsdsdsdsdsds
sdsdsdsdsdsd
sdsdsdsd
So basically small line of text at the start, and increase for the middle, then decrease in size near the end, so basically a circle type. Any ideas?
One bad way is to have a fixed number of lines (and maybe no word-wrap). Just do spans and have the id's of each span have a pre-defined width.
A better (somewhat) way is to do something along these lines css circle via stack-overflow. You may have to tweak it though (and I haven't tried it), but you could play around to see of you like it.
I'm pretty certain the latter is the way you would go, but the ease of constructing it may not be overly fast.
Good luck!
After looking around in Google, I have found this:
CSS Text Wrapper
It involves javascript, but you dont really need to know javascript in order to use it.
if you want to achieve that use
<pre></pre>
then apply the css to the text.
Its the easiest way to do that.

Alternative to CSS background sprites

A while ago I found an article which discussed a solution to an alternative to the traditional way in which CSS sprites are used and designed.
A common issue is that you need to leave space around a part of the sprite if you don't want to accidentally have other parts of the sprite "bleed" into certain elements. Thus you can use diagonal layouts and things to alleviate this problem, but they all require a lot of open white space.
This article demonstrated an alternative which let you create zero white space sprites, and let you define the exact area and dimensions of the image you want to use without worrying about bleeding. I believe it used the CSS content property in the method, but I can't be sure.
I really want to find this article again but I can't seem to find it :(
I'm sorry for my vague description, but for anyone else who saw the article, they'll know what I'm talking about. Any help finding the link? Thanks!
I think what you're referring to might be creating font icons. It allows you to have retina-ready images, while at the same time restricting you to 1 color. There are currently two good solutions to do that:
http://fontawesome.io
http://icomoon.io
There's also the way of creating SVG modifiable shapes, which in turn allows you to use shapes of almost unlimited colors and complexity. This solutions however is not perfect, as it's based upon SVGs, which are not supported by older browsers

Please help me choose a styling engine for small bits of text

I'm working on a project which will deliver small pieces of text to a display engine that will show them to the user. One of the requirements is rich styling: position, color, font, the works. Each transmission should stand alone, with its own embedded style information. I have already built a web service to deliver the text.
How should I represent this style metadata so that it's compact, flexible, easy to parse and easy to render? I haven't decided on a client to display the text, so it should be as presentation-agnostic as possible and easy to transform if I need to. I was thinking of using CSS, but I'm not on top of all the different ways to style text these days. What would you recommend?
Some more specifics about what you're trying to do might be useful. As far as I can tell though, I don't see any real reason not to use CSS or something similar.
It's easy to type, easy to learn, widely known, and there are pre-existing engines for rendering it. It can do all the basics of text styling and positioning. (And CSS3 transforms can give a lot more flexibility in terms of text positioning.) And if you end up implementing your own rendering engine for some reason, it's easy to parse and there aren't too many rules if you only need to worry about text and absolute positioning.
There are a couple of reasons I can see for not using CSS. One is if you need more advanced transformations--say, you want to skew or distort the text (in cases like this, you're going to need to end up rendering an image instead of text). In that case, I don't know of anything pre-existing that will fit your needs. (I think the closest match in that case would be SVG, but then you lose any prospect of it remaining at all simple or easy to use.)
I would say this is a perfect place for using XML. You can go way beyond the permissible values of CSS in defining your meta-information.
If you wanted something more compact you could send back objects via json with the same information.
CSS is really meant for rigid web-browser-compatible display. If that's not what you're doing here I wouldn't recommend it myself.
EDIT:
Example:
<data>
<font>Garamond</font>
<text>This is the message I'm sending back</text>
<font-weight>bold</font-weight>
<color-of-the-third-letter>green</color-of-the-third-letter>
</data>
CSS ultimately cannot be as specific as custom XML. It all depends what you want from it, though.

Resources