I'm trying to use html and css to present some simple vector notation in a webpage. A vector is simply denoted by a right-pointing arrow over a letter. Example, as an image: vector
The problem is that I might be using this notation over a few dozen different letters or symbols, and I don't want to have to stop everything and make another image each time the need for one comes up. I want to represent this using text if at all possible.
While searching, I stumbled across some HTML notation (→) for a nice right-pointing arrow (→). So, what I'd like to be able to do is come up with some css that, for a letter enclosed by a certain span class, inserts that arrow and positions it over the contents of the span.
For example:
<span class="vector">v</span>
would render like the image linked above.
Is this possible with pure css? Would I have to resort to javascript?
Thanks
Use \25bc instead. And if you want to change the color just add css color property. i used "\25bc" , i got arrow icon.
Approach: Creating an arrow using CSS is very simple. First, create an L(alphabet) shape using some box-shadow property and then rotate it to some angle to align them (both left and right arrows) together. HTML Code: In this section, two div elements are created, one for each arrow.
⨯ - vector or cross product (U+2A2F) - HTML Symbols.
The arrow is a part of the content and belongs in the HTML. You should be able to remove the JavaScript and CSS and the text should still make sense (let's say you decide to print out the page).
You should use the COMBINING RIGHT ARROW ABOVE with the vector letter to represent the full vector glyph.
I propose the following markup:
<var class="vector">v<span>⃗</span></var>
For extra nice representation you can then shift the symbol back over the letter with a touch of CSS:
var.vector {
font-style : normal;
}
var.vector span {
margin-left: -.55em; /* shift the arrow back over the letter */
vertical-align : .2em; /* tune the arrow vertical position */
}
Here is a jsbin example.
What you're specifically proposing would have to be done with Javascript, however you could do it with CSS if you used a background image for the arrow.
Something like:
span.vector {
background: url(arrow.png) no-repeat top;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With