Link??

Discussion in 'CSS' started by axxo08, Jan 2, 2010.

  1. #1
    I completely have no idea about CSS. All I want to do is that the fowllowing Button should link to another URL.I think that can be done by editing the CSS.Help me guys..:)

            <input name="button" type="submit" class="button" id="button" value="Continue" />
    
    
    Code (markup):
    Thanks in Advance :)
     
    axxo08, Jan 2, 2010 IP
  2. markupdude

    markupdude Peon

    Messages:
    215
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No to 'link' to another URL you will need an <a> tag, and this has nothing to do with CSS.
     
    markupdude, Jan 2, 2010 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Though you can use CSS to make an anchor LOOK like a button (well, kind-of) - but yeah, button is the wrong tag when making a link. The tag you want is called and ANCHOR. As frntnd said, <a href="destination.html>Anchor Text</a>

    Unless of course you are actually inside a form which is where button is supposed to be used, in which case you set "action" on the form.

    NOT that it's recommended to use BUTTON given that cross-browser it's got some pesky compatibility issues. that's really more of a job for <input type="submit"
     
    deathshadow, Jan 2, 2010 IP
  4. DocuMaker

    DocuMaker Active Member

    Messages:
    427
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Just insert onclick="document.location.href='a_webpage.html';" into your button code, so it looks like this:

    <input name="button" type="submit" class="button" id="button" value="Continue" onclick="document.location.href='a_webpage.html';"/>

    (change a_webpage.html to the page you want to load)
     
    DocuMaker, Jan 2, 2010 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    ... and say hello to using javascript to do HTML's job.
     
    deathshadow, Jan 2, 2010 IP
  6. axxo08

    axxo08 Peon

    Messages:
    298
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks Guys for the help...I tried onclick but clicking the button redirects to the same page again.
    Here's what I used.Didn't Work:(

    <input name="button" type="submit" class="button" id="button" value="Continue" onclick="document.location.href='contactus.html';"/>
     
    axxo08, Jan 2, 2010 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    I sent you a PM in response to yours, but I'll share with the group.

    For what you are doing there, button - a form element, is pretty much wrong. Having seen the page all that's needed there is:

    <a href="contactus.html" class="downloadButton">Download Now!</a>

    with this for CSS:

    .downloadButton {
    	display:block; /* let us set dimensions on it */
    	margin:0 auto; /* center it */
    	text-decoration:none;
    	font:bold 18px/20px verdana,arial,helvetica,sans-serif;
    	color:#FFF;
    	background:#800;
    	border:2px solid #000;
    }
    
    .downloadButton:active,
    .downloadButton:focus,
    .downloadButton:hover {
    	background:#C00;
    }
    Code (markup):
    An anchor is the element that SHOULD be used, it just needs a bit of CSS to make it have the button styling you wanted.
     
    deathshadow, Jan 2, 2010 IP