How do Iink a web button html and style css together html and css codes please

How do Iink a web button html and style css together html and css codes please

Really?

W3Schools Tryit Editor

1 Like

Look it up. There’s thousands of online tutorials.

10 Likes

I tried linking the stylesheet using link code didn’t work, I would love to have stylesheet and html separately for a web button

Your request isn’t clear; what exactly are you trying to do?
Can you try to explain it a bit more in detail, and share the existing HTML/CSS code you’re using to try and achieve the result you want that isn’t working?

7 Likes

Here is the code

<!DOCTYPE html>
<html>
<head>
<style>
a:link, a:visited {
  background-color: #f44336;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: red;
}
</style>
</head>
<body>

<h2>Link Button</h2>

<p>A link styled as a button:</p>
<a href="default.asp" target="_blank">This is a link</a>

</body>
</html>

I want this to be in Styles.css separately

<style>
a:link, a:visited {
  background-color: #f44336;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: red;
}
</style> 
<link rel="stylesheet" href="styles.css">

Have you created a file called styles.css with the following content?

a:link, a:visited {
  background-color: #f44336;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

a:hover, a:active {
  background-color: red;
}

If yes, and for some reason it does not work, can you link to the page of your website where this is happening so we can try to see what’s causing the issue?

5 Likes

yes I have done that and it didn’t work

I have done this on my laptop directory on my hardrive, Im prepering the index file for viewing

Provided that this is your code, it works fine for me:
index.html:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>

<h2>Link Button</h2>

<p>A link styled as a button:</p>
<a href="default.asp" target="_blank">This is a link</a>

</body>
</html>

styles.css:

a:link, a:visited {
    background-color: #f44336;
    color: white;
    padding: 14px 25px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
  
a:hover, a:active {
    background-color: red;
}

Check that your capitalization is correct (for example, make sure you haven’t accidentally named the file Styles.css with a capital S instead of a lowercase s), and check your browser’s devtools to see if an error is shown. Alternatively, you can try uploading the code here and seeing if it will work.


I noticed this part in your code:
<a href="default.asp"
If you plan on hosting an ASP webpage you’ll be likely disappointed, as the hosting platform here supports only PHP.

6 Likes

Thanks it finally worked by the way I got the page index.html to work the page under construction, it was made with html and Im still waiting for it to appear on web

Im a musing composer and I would like to know if there is a php/mysql script that I can use so that I can add my music to my website in a form that people can listen to my music no downloading just streaming, I have composed tons of music

I would upload the audio to SoundCloud and use the embed mode to share the files on your site.

6 Likes

So on SoundCloud is it possible to make your won theme for the script?

What do you mean?

5 Likes

I am going to try to use a php/mysql script but I will disable registering and leave only streaming my music compositions

You need an account to upload the audio files to them, but there will be an “embed” open that will give you HTML to put on your site to show the SoundCloud media player there.

6 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.