Vertical text with CSS in link - html

I have a really hard time getting some kind of good looking vertical text for my ribbons.
As you can see on the link
http://madbogen.com/
The first ribbon have some white text printed on the image. Is there any possible way to achieve this with CSS? Or is it enough if i just label the a-tag with a title according to what it says - I'm thinking searching etc?
I hope to achieve to same effect without using title so I can get rid of the little box coming up when hovering the ribbons.
Thanks in advance

You could use <br /> tags to stick them onto separate lines like so:
<div>
<span>H <br />E <br />L <br />L <br />O <br />! <br />
</span>
Demo here:
http://jsfiddle.net/QSByU/497/
Or alternatively you could wrap each letter in a span tag like so:
<h1>
<span> N </span>
<span> E </span>
<span> T </span>
<span> T </span>
<span> U </span>
<span> T </span>
<span> S </span>
</h1>
Demo here:
http://jsfiddle.net/QSByU/498/
There are lots of other methods that you can use to make text appear vertically (see http://code.tutsplus.com/tutorials/the-easiest-way-to-create-vertical-text-with-css--net-15284).

Thanks guys. I looked at tutsplus website and found letter-spacing and word-wrap to be what I needed.
color: white;
font-size: 16px;
word-wrap: break-word;
text-align: center;
padding-left: 15px;
padding-top: 45px;
letter-spacing: 28px;
text-decoration: none;
line-height: 105%;
font-style: normal;
font-family: "Times New Roman";

Related

Website looking really weird

Why is my paragraph bigger than the div when its inside it. To me it doesn't make any sense. Can you guys explain why this is happening and how I can fix it.
CSS:
#whos{
font-size: 15px;
color: black;
}
HTML:
<div id="Text">
<b id="bold">Hello,my name is Navjeeven</b>
<p id="whos">
I am Currently enrolled at
Brampton Christian School
</p>
</div>
What it looks like right now?
You have another style: #inside p which overrides the font size.
https://css-tricks.com/specifics-on-css-specificity/

Inconsisent gap between number and text

I got strange spacing issues. There is number and each text parallel. And there is different spacing between 1, 4, 7 and 'each' text. How can we fix this issue or it can't be fixed. I have not used any spacing and extra css properties.
#import url('https://fonts.googleapis.com/css?family=Spectral');
#import url('https://fonts.googleapis.com/css?family=Open+Sans|Spectral');
.bigger {
font-size: 40px;
}
p {
font-family: 'Open Sans', sans-serif;
}
<p>
<span class="bigger">81</span>
<small>each</small>
</p> <br>
<p>
<span class="bigger">84</span>
<small>each</small>
</p> <br>
<p>
<span class="bigger">87</span>
<small>each</small>
</p> <br>
Although using a monospace font is a nice workaround, you could solve this with your original font if it has the correct OpenType features.
The difference in the space that a digit occupies is caused by the width of the digit (as opposed to kerning or letter spacing, as suggested in the other answers). The width is proportional — the 1 is narrower than the 4.
But a font can also offer tabular figures, where each digit is of equal width:
You can enable this in CSS with font-feature-settings: 'tnum';. Or to use other OpenType features and take care of browser inconsistencies, see Utility OpenType.
That is the issue of letter spacing of the font. You should use a monospace font to achieve same spacing for all characters.
Try the below snippet.
.bigger {
font-size: 40px;
}
p {
font-family: monospace;
}
<p>
<span class="bigger">81</span>
<small>each</small>
</p> <br>
<p>
<span class="bigger">84</span>
<small>each</small>
</p> <br>
<p>
<span class="bigger">87</span>
<small>each</small>
</p> <br>
The character 1 (and 7 sometimes) would usually be spaced out in most fonts. If you want uniform spacing, you should consider using monospace fonts.
Another improvement that you can make to your code is removing the spaces between tags.
Please check the code below:
#import url('https://fonts.googleapis.com/css?family=Spectral');
#import url('https://fonts.googleapis.com/css?family=Open+Sans|Spectral');
.bigger {
font-size: 40px;
}
p {
font-family: 'Open Sans', sans-serif;
}
<p>
<span class="bigger">81</span><small>each</small>
</p> <br>
<p>
<span class="bigger">84</span><small>each</small>
</p> <br>
<p>
<span class="bigger">87</span><small>each</small>
</p> <br>

Custom css for hr tag

I'm declaring css for hr tag like ..
hr {
height: 2px !important;
background-color: #A2B1B9;
width: 9%;
margin-left: 0px;
margin-top:auto;
}
But the width of the hr tag dosen't always need to be the same as per the text that it is supported with. Please refer to the screen shot.
In this case I can either supply differen width along with the hr tag using inline css like . But as inline css dosen't fit to the ethical standards of web development is there any other approach that I could follow to make it dynamic?
HI now try to this way
Create a class and used to this css .
it's the best option for your .
.customHr{
padding-bottom:5px;
border-bottom:solid 2px black;
display:inline-block;
vertical-align:top;
color:blue;
}
<p>Custom Text here</p>
<p><span class="customHr">Custom Text here</span></p>
<p>Custom here</p>
<p>Custom Text</p>
<p><span class="customHr">Custom</span></p>
<p>Custom Text here</p>
<p>Custom Text here</p>
Rohit Azad's answer is best, but if for "ethical" reasons you would rather use an hr, you can wrap it together with the text to get the same length.
div {
display: inline-block;
}
<div>
<span>Text here</span>
<hr>
</div>
<br>
<div>
<span>T-t-t-t-t-text here</span>
<hr>
</div>
You can use Underline instead by putting the text in tag and then custom css for that.

How can I color text in HTML without using span, div, or p

I am trying to color a word this way:
<span style="color: black;"><strong>2679</strong></span> pictures in <span style="color: black;"><strong>73</strong></span> albums!
For some reason, the second span creates a line break in the text. Any ideas?
Thanks!
If all of your <strong> tags will have black text then use CSS to make it happen and ditch the <span> tags altogether:
strong {
color: #000;
}
Or if you only want some <strong> tags to be black then apply a class to those:
strong.black {
color: #000;
}
<strong class="black">2679</strong> pictures in <strong class="black">73</strong> albums!

Positioning elements like a table, without using the table tag

I am trying to position some stuff in 3 columns. The first column has an icon, 2nd column has text, and the 3rd column has an image.
I wish to do this without using the Table tag. Using CSS I have gotten the first 2 columns placed correctly, here is an image:
On the right, I need to add another image, without disturbing the text on the left.
This is my HTML code (stripped down to the basics):
<img src="Images/icon-1.png" />
<span class="content-title">My title 1</span>
<p>
Here is my text ...
</p>
<br />
<img src="Images/Icon-2.png" />
<span class="content-title">My Title 2</span>
<p>
Here is my text ...
</p>
<br />
And the CSS that emulates the table layout:
.content-title
{
font-size: 26px;
font-family: Helvetica,Arial,sans-serif;
color: #363636;
top: -28px;
position:relative;
left:+10px;
font-weight: bold;
}
#content-benefits p
{
margin-left:80px;
top:-30px;
position:relative;
width:325px;
}
My issue is, that I can't figure out how to place my image on the right, without making it's position:absolute;, but if I do that, I have to (AFAIK) use JavaScript to place the images relatively to their corresponding paragraphs.
If you want another image add it to the HTML before the rest of the "section" and then float it right with:
img {
float: right;
}
On another note, why aren't you using heading tags to display your headings?
You could use the css display:table to make it apear using a table take a look at the docs for this found here
Place the image after the titles span end tag
<img src="Images/icon-1.png" />
<span class="content-title">My title 1</span>
<img src="Images/icon-1.png" />
<p>
Here is my text ...
</p>
<br />
if i properly understand your layout i would do this
<img style="float:left; width:80px" src="image/icon-1.png"/>
<div style="width:405px">
<img style="float:right; width:80px"/>
<div style="float:left; width:325px">
<span/>
<p>
...
</p>
</div>
</div>
you wont need the other positioning you used
if you cannot change the markup,
than put width to the span and p and float:left, and put float:right and width to img
putting float automatically converts the element to display:inline-block which mean that it no longer distributes to the free page width, but takes the minimal allowed space (set by width) and stays rectangular. This way it becomes something like a column.