Code Monkey home page Code Monkey logo

Comments (2)

gemal avatar gemal commented on August 23, 2024

btw: loove your project!

from simple.css.

kevquirk avatar kevquirk commented on August 23, 2024

Hi @gemal,

There are a couple of ways to achieve a linked button. The first way, which is what many people do, is to add a class using a custom stylesheet. Something like this will work:

.button {
  border: none;
  border-radius: 5px;
  background: var(--accent);
  font-size: 1rem;
  color: var(--bg);
  padding: .7rem .9rem;
  margin: .5rem 0;
  transition: .4s;
}

Then you would add a standard link, but with the class of button to it's formatted to look like a button:

<a class="button" href="https://example.com">Click here</a>

If you prefer not to add custom CSS, then the alternative is to add a very simple line of inline JavaScript to your button that effectively makes the button a link. Like this:

<button onclick="window.location.href='https://example.com';">Click here</button>

This second solution is easier, but the caveat here is that buttons will break for any users that don't have JavaScript enabled.

Hope this helps,

Kev

from simple.css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.