Hi,
I created one website but in that website
in that site i make a link and applied style sheet but in browser style sheet not appered

please help me

Dani AI

Generated

Short answer: the stylesheet is probably loading (see 's span test), but link text must be styled on the anchor or via a selector that targets the anchor. A class on a surrounding element does not always override user-agent link rules or link pseudo-classes, so either put the class on the <a> itself or write a selector that targets anchors inside your element.

Example — give the anchor the class and style its states:

/* in your CSS */
a.mainsheetLink {
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  color: #6a5341;
  font-weight: bold;
  text-decoration: none;
}

a.mainsheetLink:hover {
  color: #4a3723;
  text-decoration: underline;
}
<!-- in your HTML -->
<a href="page.html" class="mainsheetLink">Example link</a>

If you prefer to keep the class on the parent (as you tested), target the anchor with a descendant selector:

/* keep the class on the container and style any link inside it */
.mainsheet2 a {
  color: #6a5341;
  text-decoration: none;
}

Quick troubleshooting checklist (builds on and comments):

  • Use the browser inspector to see which rule is actually applied and which rule overrides it (computed styles and cascade).
  • Check for typos in class names and that the CSS file reference in the page head points to the correct file; clear cache or add a version query string to force reload.
  • Be mindful of specificity: a more specific selector or an element rule for a can win; increase specificity rather than using !important.
  • Remember link pseudo-class order matters: :link, :visited, :hover, :active (LVHA). Modern browsers also restrict some :visited styling for privacy; see MDN for details: MDN :visited.

Recommended Answers

All 7 Replies

hi ! may be the style u embedded is not supported by the browsers.

Will u please let me know wat codes u used for the style

.mainsheet2{
	font-family:tahoma;
	font-size:11px;
	color:#6a5341;
	font-weight:bold;
	vertical-align:middle;
	text-align:center;
}

Please check this once...

Me performs, i've inserted to HTML code this:

<span class="mainsheet2"> example </span>

It works.

Me performs, i've inserted to HTML code this:

<span class="mainsheet2"> example </span>

It works.

but where i can give link

but if i use this code where can i give hyperlink

Hello guys! Thus anyone here knows best CSS tutorial sites... I really wanted to know CSS... and build my own site...

You have to put the link in <a> tags. A style can't have a link.

Or are you wanting the link to the style sheet. It goes in the style tag in the head section.

Note that browsers can switch off color changes for links with user settings.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.