-
Notifications
You must be signed in to change notification settings - Fork 47
/
css-button-generator.html
262 lines (250 loc) · 13.2 KB
/
css-button-generator.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
title: CSS Button Generator | HTML Tools
layout: post
---
<html>
<head>
<!-- Meta tags common for website -->
{% include common-meta %}
<title>{{ page.title }}</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="description" content="This is easy to use open source tool to generate cross browser CSS HTML button code for web pages." />
<meta name="keywords" content="online,tool,css,button,tag,html,web,opensource" />
<!-- CSS for the site theme -->
{% include theme-css %}
<link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
<link rel="stylesheet" href="plugins/bootstrap-slider/slider.css">
<!-- Annoying IE fixes -->
{% include ie-fixes %}
</head>
<body class="hold-transition skin-green sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<!-- header tag from theme -->
{% include theme-header %}
<!-- Sidebar for the whole website -->
{% include theme-sidebar %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-6">
<div class="box box-success">
<div class="box-header with-border">
<h1 class="box-title">Generate CSS Button Code</h1>
</div>
<!-- /.box-header -->
<!-- form start -->
<div class="box-body">
<form role="form">
<div class="form-group">
<label for="background-color">Background Color</label>
<input class="form-control background-color colorpicker-element" id="background-color" value="#4CAF50" />
</div>
<div class="form-group">
<label for="color">Text Color</label>
<input class="form-control color colorpicker-element" id="color" value="#ffffff" />
</div>
<div class="form-group">
<label for="button-text">Button Text</label>
<input class="form-control" id="button-text" value="Button" />
</div>
<div class="form-group">
<label for="font-size">Font Size(px)</label>
<input class="slider form-control" value="16" id="font-size" data-slider-id='font-size' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="16" />
</div>
<div class="form-group">
<label for="border-style">Border Style</label>
<select class="form-control" id="border-style" >
<option value="none" selected="selected">None</option>
<option value="dotted">Dotted</option>
<option value="dashed">Dashed</option>
<option value="solid">Solid</option>
<option value="double">Double</option>
<option value="groove">Groove</option>
<option value="ridge">Ridge</option>
<option value="inset">Inset</option>
<option value="outset">Outset</option>
</select>
</div>
<div class="form-group">
<label for="border-width">Border Width(px)</label>
<input class="slider form-control" value="0" id="border-width" data-slider-id='border-width' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="16" />
</div>
</form>
</div>
<!-- /.box-body -->
</div>
</div>
<div class="col-md-6">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Preview Your Button Here</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<div id="result">
<button>Button</button>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Copy Code Here</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<div class="form-group">
<label for="title">HTML Code For This Button</label>
<textarea class="form-control" rows="2" id="resultCodeHTML" readonly="readonly"></textarea>
</div>
<div class="form-group">
<label for="title">CSS Code For This Button</label>
<textarea class="form-control" rows="5" id="resultCodeCSS" readonly="readonly"></textarea>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
</div>
</div>
</section>
<section class="content">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">About CSS Button Generator Tool</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<img class="img-responsive" src="images/css-button.jpg" alt="Online CSS Button Generator Tool for website" title="Online CSS Button Generator Tool for website">
<p>This is a free online tool to generate CSS styled beautiful looking HTML button code for any web page. You can customize your button as per your website design and use the code.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">What is a CSS?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>CSS (Cascading StyleSheet) is a language for HTML page beautification. A very plain HTML page can be transformed with simple CSS code into a really beautiful and highly usable page. It helps user by making page more readable and
good for use.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Does This Button Work On All Browsers?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>The generated CSS button code is compatible with all modern browsers including Google Chrome, Firefox, Safari and Internet Explorer. We have used cross browser HTML and CSS styles to keep it simple.</p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">How To Create These Buttons?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>If you do not have a preference, you can just pick the default button with just text customization. Feel free to play around with different values to change the look and feel of the button. </p>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">What Colors Do I Choose?</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<p>A button needs to fit with your website colors theme. Try to use the colors on your website in the button instead of inventing a new color. For most people default settings are good enough with a slight color change.</p>
</div>
<!-- /.box-body -->
</div>
</section>
{% include addthis %}
</div>
<!-- /.content-wrapper -->
{% include theme-footer %}
</div>
<!-- ./wrapper -->
{% include theme-bottom-js %}
</body>
<script src="plugins/bootstrap-slider/bootstrap-slider.js"></script>
<script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="plugins/selectOnFocus/jquery.selectOnFocus.min.js"></script>
<script>
$(document).ready(function() {
$('.slider').slider();
var btn = $("#result button");
registerColorPicker("background-color", btn);
registerColorPicker("color", btn);
$("#button-text").on("input", function() {
btn.text($("#button-text").val());
resetHTML();
});
registerSizeAttribute("font-size",btn);
registerSizeAttribute("border-width",btn);
$("#border-style").on("change", function() {
btn.css("border-style", this.value);
resetCSS();
});
reset(btn);
resetCSS();
resetHTML();
$("#resultCodeCSS").selectOnFocus();
$("#resultCodeHTML").selectOnFocus();
$('#generators-category').addClass('active');
});
var reset = function(btn) {
btn.css("background-color", "#4CAF50");
btn.css("border-style", "none");
btn.css("border-width", "0px");
btn.css("color", "white");
btn.css("padding", "15px 32px");
btn.css("text-align", "center");
btn.css("text-decoration", "none");
btn.css("display", "inline-block");
btn.css("font-size", "16px");
btn.css("margin", "4px 2px");
btn.css("cursor", "pointer");
};
var resetCSS = function() {
var newLineNTab = "\n ";
var css = "<style>\n.button {" + newLineNTab + "background-color: " + $("#background-color").val() +";" + newLineNTab + "border-style: " + $("#border-style").children("option").filter(":selected").text() + ";" + newLineNTab + "border-width: " + $("#border-width").val() + "px;" + newLineNTab + "color: "+ $("#color").val() + ";" + newLineNTab + "padding: 15px 32px;" + newLineNTab + "text-align: center;" + newLineNTab +
"text-decoration: none;" + newLineNTab + "display: inline-block;" + newLineNTab + "font-size: " + $("#font-size").val() + "px;" + "\n" + "}\n<\/style>";
$("#resultCodeCSS").val(css);
};
var resetHTML = function() {
var html = "<button class=\"button\">"+ $("#button-text").val() + "<\/button>";
$("#resultCodeHTML").val(html);
};
var registerColorPicker = function(itemId, btn) {
var elementId = "#" + itemId;
$(elementId).colorpicker().on('changeColor',
function(ev) {
btn.css(itemId, $(elementId).val());
resetCSS();
});
$(elementId).on("input", function() {
btn.css(itemId, $(elementId).val());
resetCSS();
});
};
var registerSizeAttribute = function(itemId,btn) {
var elementId = "#" + itemId;
$(elementId).on("input", function() {
btn.css(itemId, $(elementId).val() + "px");
resetCSS();
});
};
</script>
</html>