Jump to content
  • 0

Set Button Style


RonAnderson

Question

Any suggestions would be really appreciated... I'm trying to format a "Logout" button to be the same style as image.png.9b3486f4037cc13e9f6e59a1dbc7068e.png Please ignore the "Click here to use Low Cost"

The code I'm using does the job of logging out but the format is inconsistent with all the other buttons on the submission datapage.  Here's the logout button appearanceimage.png.8048d1a36314545a448c7b41a4516f9f.png

The code I'm using is:-

<button><a href="https://c7cmr949.caspio.com/folderlogout">Logout</a>
<style="background-color: #787A7C; /* Gray*/
  border: none;
  color: white;
  border-radius: 5px;
  padding: 7px 75px;
  text-align: center;
  display: inline-block;
  font-size: 14px;
</style>
</button>

It's as if all of the style code is being ignored.

Cheers, Ron

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

Update: to get rid of !important property it is possible to add the ID for the link since ID selectors have the highest specificity.

For example:

<button class="btn-logout" type="button">
  <a id="link-logout" href="https://c7cmr949.caspio.com/folderlogout">Logout</a>
</button>

And styles:

<style>
.btn-logout {
  background-color: #787A7C; /* Gray*/
  border: none;
  border-radius: 5px;
  padding: 7px 75px;
  text-align: center;
  display: inline-block;
}

#link-logout,
#link-logout:hover {
  color: white;
  font-size: 14px ;
  text-decoration: none;
}
</style>

 

Link to comment
Share on other sites

  • 1

Hello @RonAnderson,

1) I would recommend you to add the type of the button: type="button" and a CSS class to style the button.

For example, this code can be added to the HTML block/Header/Footer depending on where you need to add a button:

<button class="btn-logout" type="button">
  <a href="https://c7cmr949.caspio.com/folderlogout">Logout</a>
</button>

2) Actually, you need to style a button and a link. A link has default styles on hover so we need to consider that too.

Please test these styles, and add them to the Header (disable the HTML editor before pasting)
 

<style>
.btn-logout {
  background-color: #787A7C; /* Gray*/
  border: none;
  border-radius: 5px;
  padding: 7px 75px;
  text-align: center;
  display: inline-block;
}

.btn-logout a {
  color: white !important;
  font-size: 14px !important;
  text-decoration: none !important;
}

.btn-logout a:hover {
  color: white !important;
  font-size: 14px !important;
  text-decoration: none !important;
}
</style>

This is the button I can see as a result
s7CkeWm.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...