Reputation: 1733
How can I make h3 tag appear like this?
I tried to apply width and max-width css rules (e.g width: 120px; or 150px) but the words appears to each next to each other.
Any suggestion?
Upvotes: 1
Views: 331
Reputation: 1935
Like so:
<h3 style="width:120px;text-align:center;text-transform:uppercase;">Sell Anywhere</h3>
Without inline styling:
<h3 class="sell-anywhere">Sell Anywhere</h3>
h3.sell-anywhere
{
width: 120px;
text-alignment:center;
text-transform:uppercase;
}
Upvotes: 1
Reputation: 2396
One of the ways to do that:
h3{
text-transform:uppercase;
background:green;
color:white;
float:left;
text-align:center;
width:100px;
}
There are more than few, I guess.
Upvotes: 4
Reputation: 2587
See the jsfiddle and it would be great if you provide your code.
<h3 style="width:100px;text-align:center;color:white;background:black"> SELL ANYWHERE </h3>
Upvotes: 1
Reputation: 6346
Use text-align:center
combined with fixed width : http://jsfiddle.net/wQUyR/
h3 {
background:blue;
display:block;
width:70px;
text-align:center;
}
Upvotes: 1
Reputation: 13115
You need to provide more HTML/CSS code for a better answer, but with the information provided I would assume you may need to set your h3
tag to display: block
In this example, I did not need to set display to block
, it just works: http://jsfiddle.net/vwwZs/
So maybe you have some other conflicting CSS being applied.
Hope this helps
Upvotes: 1