Ronan
Ronan

Reputation: 327

Setting border in css

My border moves when I set padding to the left in my .sidebar in CSS or a margin in .sidebar td.

I want the padding here but I want the border to go all the way across but it moves with the text every time I add the padding/margin.

CSS

.sidebar {
    float: right;
    padding-left: 20px;
    padding-top: 10px;
    padding-bottom: 0px;
    margin-left: 865px;
    height: inherit;
    border: groove;
    border-color: #eeeeee;
    border-radius: 10px;
    margin-top: -265px;
    position: fixed;
    font-size: 15px;
}

.sidebartda {
    border: 1 px solid;
    display: table;
    height: 40px;
    width: 200px;
    border-color: #D6D6D6;
    border-left-style: none;
    border-right-style: none;
    border-top-style: none;
    margin-bottom: -1px;
    margin-top: 10px;
}
.sidebartda:link {
    color: #eeeeee;
}

HTML

<div class="sidebar">
<table>
    <tr>
        <td><a href="Develop.aspx#FreeAPI">Free API</a></td>
    </tr>
    <tr>
        <td><a href="Develop.aspx#ProAPI">Pro API</a></td>
    </tr>
    <tr>
        <td><a href="Develop.aspx#Platform">Platform</a></td>
    </tr>
</table>

My link color doesn't seem to work either except on 2 random links on one of the pages. Any tips?

Upvotes: 1

Views: 154

Answers (3)

Mr. iC
Mr. iC

Reputation: 129

aren´t you missing the dot at "sidebar" (line 1)? - the link color is not working because the link color is only working on links you´ve never visited before. a:visited, a:link, a:hover might be a good option too.

padding and margin are better written: padding: 10px (top) 0px(right) 0px (bottom) 20px (left); -> padding: 10px 0px 0px 20px; same with margin..

Upvotes: 0

शेखर
शेखर

Reputation: 17614

Here is a fiddle for the same.

.sidebar td a:link{color:#000;}
.sidebar td a:visited{color:#000;}
.sidebar td a:active{color:#000;}
.sidebar td a:hover{color:#000;}

Upvotes: 1

Vladimir Kocjancic
Vladimir Kocjancic

Reputation: 1844

a:link only works on unvisited links (that is anchor tags with href attribute set that you have nto clicked on). So, if you ever visited a link, a:link css rule will not apply to it. For styling those, you have to set a:visited.

Check http://www.w3schools.com/cssref/sel_link.asp

Upvotes: 0

Related Questions