Vertically Align texts with different sizes in <a> - css

I want to align an addition(plus) mark and text next to it, however, since the "+" is too small, it is enlarged with a tag. This causes the character to become too big, making it hard for me to align them. How would I align the + character and Text evenly next to each other?
This is the code:
http://jsfiddle.net/rs75V/

Have you tried
vertical-align:middle;
or
vertical-align:-10%;
? This looks all right to me.

Try playing around with this:
http://www.w3schools.com/cssref/pr_pos_vertical-align.asp
I think it's what you're looking for, it has a ton of different ways to move text alignment up or down.

It's hackish, but this should work.
a{
font-family: arial, sans-serif;
background-color: #EEEEEE;
border: 1px solid #DDDDDD;
border-bottom: 1px solid #BBB;
color: #333;
padding: 4px 10px;
text-align: center;
text-shadow: 0 1px 0 #EEE;
font-weight:bold;
font-size:20px;
line-height:40px;
display:inline-block;
cursor:pointer;
}
span{
font-size:40px;
vertical-align:-15%;
}

Try floating your a and span.
a{
font-family: arial, sans-serif;
background-color: #EEEEEE;
border: 1px solid #DDDDDD;
border-bottom: 1px solid #BBB;
color: #333;
padding: 4px 10px;
text-align: center;
text-shadow: 0 1px 0 #EEE;
font-weight:bold;
font-size:20px;
cursor:pointer;
line-height: 40px;
float: left;
}
span {
font-size:40px;
float: left;
margin: 0 .1em 0 0;
}

You can display the span as an inline-block and then use padding on it...
a{
font-family: arial, sans-serif;
background-color: #EEEEEE;
border: 1px solid #DDDDDD;
border-bottom: 1px solid #BBB;
color: #333;
padding: 4px 10px;
text-align: center;
text-shadow: 0 1px 0 #EEE;
font-weight:bold;
font-size:20px;
display:inline-block;
cursor:pointer;
}
span{
font-size:40px;
line-height: 0;
display: inline-block;
padding-bottom: 9px;
}

Try this:
span {
font-size: 40px;
line-height: 0;
vertical-align: middle;
}

Related

Disabled selected thead color datatable

i want to disabled thead color when active/selected, i mean thead color still #dddfe2 when sorting/thead selected.
The default clor is #dddfe2 .
CSS :
#new-izbox table thead th{
background: #dddfe2;
border-left:0px;
border-right:0px;
border-top: 0px;
border-bottom: 1px solid #dddfe2;
text-align: left;
font-weight: normal;
color: #555;
padding:10px;
margin:0px;
text-align: left;
cursor: pointer;
}
I try something like this, but no luck :
#new-izbox table thead th.selected{
background: #dddfe2;
border-left:0px;
border-right:0px;
border-top: 0px;
border-bottom: 1px solid #dddfe2;
text-align: left;
font-weight: normal;
color: #555;
padding:10px;
margin:0px;
text-align: left;
cursor: pointer;
}
any helps will be appreciated.

Bottom-border isn't a crisp 1px line when you hover

When you hover the sentence, the bottom-border isn't a crisp 1px line, like when you hover over photography. I've set margin:0; and padding:0; also. http://imdarrien.com/#
.project-link-1 {
display: inline;
text-align: left;
margin-bottom: 14px;
}
.project-link-1 a:hover {
border-bottom: 1px solid #000;
}
.project-link-1 > a {
font-family: 'NimbusSansNo5TOT-Regular';
border-bottom: 1px solid transparent;
font-size: 13px;
line-height: 16px;
word-spacing: 2px;
text-decoration: none;
color: #000;
}
It's because you use transform with percentages. Your content gets antialiased. You could try to remove the transform from .project_miniwrap or position it pixel perfect.

CSS div border changes to black when visited

I have a menu where each link is a div box. This div box have a gray border-bottom, however, when the link is visited it turns black. I just can't figure why.
On the following image I've clicked the Rediger profil and Log af links.
JSFiddle: http://jsfiddle.net/LpGbT/
HTML
<div id="design_sidebar">
<div id="design_sidebar_head">
Patrick Reck
</div>
<div class="design_sidebar_menu_item">Besøgende</div>
<div class="design_sidebar_menu_item">Mine favoritter</div>
<div class="design_sidebar_menu_item">Rediger profil</div>
<div class="design_sidebar_menu_item">Log af</div>
</div>
CSS
a {
text-decoration: none;
}
#design_sidebar {
width: 200px;
float: left;
border: 1px solid #d6d6d6;
-moz-border-radius: 2px;
border-radius: 2px;
background-color: white;
}
#design_sidebar_head {
width: 165px;
height: 30px;
font-family: Segoe;
font-size: 14px;
font-weight: bold;
color: #333333;
padding-top: 10px;
padding-left: 35px;
border-bottom: 1px solid #d6d6d6;
background-image: url('../img/icons/user.png');
background-repeat: no-repeat;
background-position: 10px 11px;
background-color: #f7f7f7;
}
.design_sidebar_menu_item {
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #d6d6d6;
}
.design_sidebar_menu_item:hover {
color: white;
background-color: #a6242f;
}
You may define a copied version of your div selector with a :visited suffix in order to set new colours for visited objects.
Aldo div classes are prefixed with a dot (.) instead of a sharp (#) character. Just a reminder. :)
.design_sidebar_menu_item:visited {
border-color: <your_color>;
}
If it doesn't harm your design etc. I would suggest this:
HTML:
<div id="design_sidebar">
<div id="design_sidebar_head">
Patrick Reck
</div>
Patrick Reck
Besøgende
Mine favoritter
Rediger profil
Log af
</div>
CSS:
div#design_sidebar a {
text-decoration: none;
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #d6d6d6;
display: block;
}
div#design_sidebar a:hover {
color: white;
background-color: #a6242f;
}
#design_sidebar {
width: 200px;
float: left;
border: 1px solid #d6d6d6;
-moz-border-radius: 2px;
border-radius: 2px;
background-color: white;
}
#design_sidebar_head {
width: 165px;
height: 30px;
font-family: Segoe;
font-size: 14px;
font-weight: bold;
color: #333333;
padding-top: 10px;
padding-left: 35px;
border-bottom: 1px solid #d6d6d6;
background-image: url('../img/icons/user.png');
background-repeat: no-repeat;
background-position: 10px 11px;
background-color: #f7f7f7;
}
EDIT:
How about adding:
a {
text-decoration: none;
display: block;
border-bottom: 1px solid #d6d6d6;
}
And removing border-bottom: 1px solid #d6d6d6; from .design_sidebar_menu_item {...}
The others will need links around them for this to work.
It doesn't..
I changed border-bottom color to 'green'. Now you have a clear view.
Check jsFiddle : check it out
.design_sidebar_menu_item {
padding: 5px;
padding-left: 10px;
font-size: 14px;
color: #333333;
border-bottom: 1px solid #00FF00;
}

Is there a way with Javascript to determine where a line break is placed in HTML?

I have this html:
<div id="tagsCloud" class="feedBarSegment">
<div id="tagsCloudHeader" class="segmentHeader">Tags</div><span class="tag">Psalm 33</span><span class="tag">Edgar Allen Poe</span><span class="tag">John</span><span class="tag">Hello</span><span class="tag">Test</span></div>
With this CSS:
.segmentHeader {
font-size: 1.15em;
font-weight: bold;
border-bottom: #7792ad solid 1px;
margin-bottom: 5px;
}
.feedBarSegment {
width: 250px;
margin: 52px 20px 20px 25px;
}
#tagsCloud {
margin-top: 10px;
}
.tag {
display: inline-block;
background: #e9e3c4;
padding: 2px 4px;
border-top: 1px black solid;
border-right: 1px black solid;
}
.subject {
display: inline-block;
background: #f2b2a8;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 2px 3px 2px 3px;
border: black solid 1px;
margin: 2px;
}
I want to make it so that on each line, if no more tags fit that the tags on that line have padding added to them so that they completely span the entire line instead of having the extra space at the end. Is this possible to do?
If you can move from inline-block to inline for .tags you can use text-align: justify; on the container.
I believe what you're looking for is:
#tagsCloud {
text-align:justify;
}
http://www.w3schools.com/cssref/pr_text_text-align.asp
It seems like what you want is text-align: justify.

CSS: Stop List Items nudging right on hover?

I have a menu that needs a dotted border on hover, is it possible to stop it nudging the list items to the right on hover?
http://jsfiddle.net/mkTvp/
It will be in a CMS so I can't set a width on the LI's
Give the items 2px transparent borders: http://jsfiddle.net/mkTvp/1/
Just add a border to the original style the same color as the background:
li {
display: block;
float: left;
padding: 3px;
border: 2px solid #fff; /*same as background color*/
}
Example here.
a {
background-color: #F78F1E;
color: #fff;
display: block;
font-family: helvetica, sans-serif;
font-size: 0.688em;
font-weight: bold;
padding: 12px 12px;
text-decoration: none;
text-transform: uppercase;
width: auto;
}
li {
display: block;
float: left;
padding: 1px;
border: 2px solid white; /** Same as background-color */
}
li:hover { border: 2px dashed #F78F1E;}

Resources