登录 | 注册 | FAQ
Anonymous

CSS link

+ 发表回复

4 篇帖子 分页: 1 / 1


CSS link

FunkyB » 周二 4月 29, 2014 7:55 pm

Hello

I hope you can help me. I am designing a website with use of .css file as shown below. For the navigation bar.

<link href="default.css" rel="stylesheet" type="text/css"/>

However it highlights all the other links on the page. I am finding this a headache. I don't know what to do. I can't of possibly done anything wrong?

Advise would be very much welcomed. Thanks in advance.
头像

FunkyB

  • 帖子: 2
  • 注册: 周二 4月 29, 2014 7:49 pm

Re: CSS link

FunkyB » 周二 4月 29, 2014 7:58 pm

Forgot to add this:

ul
{
list-style-type:none;
margin:0;
padding:10;
}
li
{
display:inline;
}
a:link,a:visited
{
color:#FFFFFF;
background-color:#B4CDCD;
text-align:center;
padding:10px;
text-decoration:none;
}
a:hover,a:active
{
background-color:#7A8B8B;
}
头像

FunkyB

  • 帖子: 2
  • 注册: 周二 4月 29, 2014 7:49 pm

Re: CSS link

comport9 » 周六 5月 31, 2014 12:52 am

It's applying your css rules to all links on the page because that's what you told it to do. If you want your navigation links to be styled differently from other links you have to use classes or id's to keep them separate. (Use classes...)

<a class="link" href="#">Stuff</a>

.link {
background-color: red;
}

Now, only links with the class "link" will be given the background colour "red".
头像

comport9

  • 帖子: 28
  • 注册: 周日 11月 04, 2012 5:35 pm

Re: CSS link

Veeramanikandan » 周四 5月 07, 2015 3:13 pm

<link rel="stylesheet" type="text/css" href="style.css">
set the background-color:red; on your css file its simple way to find our link has been work or not
头像

Veeramanikandan

  • 帖子: 20
  • 注册: 周一 9月 22, 2014 4:03 pm


+ 发表回复

分页: 1 / 1