So I have this problem, which has never happened to me before.
I am trying to put a text field exactly next to an a button, which I already did and it looks great.
The problem is that it looks great on firefox, but on chrome the only issue is the button's height. I dont know why its not taking the specified height. Everything else on my site works great (height wise) its all the same specified hight on all cross-platforms
Here is the code:
HTML
<div> <!-- filter item start -->
<p>
<a href="#" id="add-friend-feed-link">
Add Friend
</a>
</p>
<form method="post" action="" name="searchFriendForm" id="add-friend-search">
<input type="text"/ name="searchFriendText">
<input type="button" class="small green button" id="add-friend-button"/>
</form>
<hr>
</div> <!-- filter item end -->
and CSS
/* Absolutes start */
#add-friend-search{
display: block;
position: absolute;
}
#add-friend-search input[type="text"]{
-moz-border-radius:4px 0px 0px 4px;
-moz-box-shadow:0 1px 0 #444444;
-webkit-border-radius:4px 0px 0px 4px;
-webkit-box-shadow:0 1px 0 #444444;
border-radius:4px 0px 0px 4px;
box-shadow:0 1px 0 #444444;
background:none repeat scroll 0 0 #D4D8DF;
border:1px solid black;
color:#444444;
font:13px Arial,sans-serif;
height:19px;
margin: 20px 4px 4px;
padding:5px 6px 4px;
width:250px;
text-align: center;
float: left;
display: inline-block;
}
#add-friend-search{
background:url("../images/small arrow.png") no-repeat scroll 88px 2px transparent;
display:block;
position:absolute;
width:332px;
}
#add-friend-search input[type="button"]{
background:url("../images/search icon.png");
background-position: center;
}
#add-friend-button{
border: 1px solid black;
border-radius: 0 4px 4px 0;
-moz-border-radius: 0 4px 4px 0;
-webkit-border-radius: 0 4px 4px 0;
display: inline-block;
height: 21px !important;
margin-right: 33px;
margin-top: 20px;
position: absolute;
right: 0;
max-height: 31px;
}
/*Absolutes end */
this is what it looks like in Firefox
and this is what it looks like in chrome
this is the button xcss that contains small, green but I am not supposed to modify this CSS AT ALL
/*--------------------------------------------------------------------------------------------
Button Styles Reset - Gets rid of Browser Specific Issues
-------------------------------------------------------------------------------------------- */
input[type="button"], button {
border:0 none;
font:inherit;
}
*:focus{outline:0 none;}
input[type="submit"] {border:1px solid rgba(0, 0, 0, 0.25);}
input[type="button"], button {-moz-box-sizing: content-box;}
input[type="button"]::-moz-focus-inner, button::-moz-focus-inner { padding:0;border:0 none; }/*fixes mozilla button padding */
.clearfix:after {
clear: both;
content: '.';
display: block;
font-size: 0;
line-height: 0;
visibility: hidden;
width: 0;
height: 0;
}
/*--------------------------------------------------------------------------------------------
General Button Styles, Cascades Down To Every Button
-------------------------------------------------------------------------------------------- */
.button {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50);
-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50);
box-shadow:0 1px 3px rgba(0, 0, 0, 0.50);
background:#222222 url(button-images/button-overlay.png) repeat-x;
border:1px solid rgba(0, 0, 0, 0.25);
color:#FFFFFF !important;
cursor:pointer;
display:inline-block;
font-size:13px;
font-weight:bold;
line-height:1;
overflow:visible;
padding:5px 15px 6px;
position:relative;
text-decoration:none;
text-shadow:0 -1px 1px rgba(0, 0, 0, 0.25);
width:auto;
text-align:center;
}
.button:hover {
background:#111111;
color:#FFFFFF;
}
.button:active {
background:#242424;
}
.green.button {
background-color:#91BD09;
}
.green.button:hover {
background-color:#749A02;
}
.green.button:active {
background-color:#a4d50b;
}
.blue.button {
background-color:#0E59AE;
}
.blue.button:hover {
background-color:#063468;
}
.blue.button:active {
background-color:#1169cc;
}
.purple.button {
background-color:#660099;
}
.purple.button:hover {
background-color:#330066;
}
.purple.button:active {
background-color:#7f02bd;
}
.breen.button {
background-color:#2DAEBF;
}
.breen.button:hover {
background-color:#007D9A;
}
.breen.button:active {
background-color:#36cbdf;
}
.red.button {
background-color:#CC0000;
}
.red.button:hover {
background-color:#990000;
}
.red.button:active {
background-color:#ea0202;
}
.magenta.button {
background-color:#A9014B;
}
.magenta.button:hover {
background-color:#630030;
}
.magenta.button:active {
background-color:#ce025c;
}
.orange.button {
background-color:#FF5C00;
}
.orange.button:hover {
background-color:#D45500;
}
.orange.button:active {
background-color:#fd762a;
}
.yellow.button {
background-color:#FFE115;
}
.yellow.button:hover {
background-color:#E4C913;
}
.yellow.button:active {
background-color:#fee539;
}
.white.button {
background-color:#FFFFFF;
border:1px solid #CCCCCC;
color:#666666 !important;
font-weight:normal;
text-shadow:0 1px 1px #FFFFFF;
}
.white.button:hover {
background-color:#EEEEEE;
}
.white.button:active {
background-color:#ffffff;
}
.gray.button {
-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.50);
background:#FFFFFF url(button-images/button-overlay-black.png) repeat-x;
border:1px solid #BBBBBB;
color:#555555 !important;
text-shadow:0 1px 1px rgba(255, 255, 255, 0.5);
}
.gray.button:hover {
background-color:#EEEEEE;
border-color:#999999;
color:#444444 !important;
}
.gray.button:active {
background-color:#ffffff;
}
/*--------------------------------------------------------------------------------------------
Small Buttons
-------------------------------------------------------------------------------------------- */
.small.button {
font-size:11px;
padding:5px 15px 6px;
background-image:url(button-images/small-button-overlay.png);
}
input[type="submit"].small.button, .small.button.input {
padding:3px 15px 4px;
}
input[type="button"].small.button, button.small.button {
padding:4px 15px;
}
/*--------------------------------------------------------------------------------------------
Tall Buttons
-------------------------------------------------------------------------------------------- */
.tall.button {
font-size:14px;
padding:8px 19px 9px;
background-image:url(button-images/tall-button-overlay.png);
}
.tall.gray.button {
background-color:#FFFFFF;
background-image: url(button-images/tall-black.png);
background-repeat:repeat-x;
}
.tall.gray.button:hover {
background-color:#EEEEEE!important;
border-color:#999999;
color:#444444 !important;
}
.tall.gray.button:active {
background-color:#FFFFFF!important;
}
.tall.button em {
font-size:11.5px;
font-style:normal;
display:block;
margin-top:5px;
}
/*--------------------------------------------------------------------------------------------
Round Buttons
-------------------------------------------------------------------------------------------- */
.round.button {
-moz-border-radius:15px;
-webkit-border-radius:15px;
border-radius:15px;
background-image:url(button-images/round-button-overlay.png);
border:1px solid rgba(0, 0, 0, 0.25);
font-size:13px;
padding:0;
}
.round.button span {
-moz-border-radius:14px;
-webkit-border-radius:14px;
border-radius:14px;
display:block;
line-height:1;
padding:4px 15px 6px;
}
.round.button.input {
padding:3px 13px 4px;
}
.small.round.button {
-moz-border-radius:12px;
-webkit-border-radius:12px;
border-radius:12px;
font-size:11px;
}
input[type="button"].round.small.button, button.round.small.button {
padding:0;
}
.small.round.button span {
-moz-border-radius:11px;
-webkit-border-radius:11px;
border-radius:11px;
padding:6px 15px 6px;
}
.large.round.button {
-moz-border-radius:18px;
-webkit-border-radius:18px;
border-radius:18px;
background-position:left bottom;
}
.large.round.button span {
-moz-border-radius:17px;
-webkit-border-radius:17px;
border-radius:17px;
font-size:14px;
padding:7px 20px 9px;
}
.large.tall.round.button small {
display:block;
margin-top:5px;
}
Chrome and Firefox seem to be in conflict with displaying the styles in your classes: small, green and input in conjuction with the style applied for the id add-friend-button.
There are a lot of styles being applied against that button. I would suggest you try to rebuild that form, adding a class at a time and check in each browser until you encounter the difference.
EDIT
The difference between the rendering of the submit button is due to
-moz-box-sizing: content-box;
located in your css class
input[type="button"], button {
-moz-box-sizing: content-box;
}
turn if off in firebug in firefox and you will see the button take on the same dimensions as in chrome.
There's a good article on this at quirksmode.org and you can find documentation on box-sizing on MDN. The solution is the same as what Nicholas suggests.
input[type=submit], input[type=button], button {
box-sizing: content-box;
-moz-box-sizing: content-box;
-ms-box-sizing: content-box;
-webkit-box-sizing: content-box;
}
Like with border-radius, I prefer to use a SASS mixin to handle the browser prefixes.
Related
I have div that have box-shadow on it and have also div:hover box-shadow.
When i check results at JSfiddle its all fine.
But when i check the results at my site i get the box-shadow right side removed:
Here is the Live code: JSfiddle
And here is the Code:
.nitz {
font-family: sans-serif;
font-size: 0;
width: 300px;
height: 76px;
direction: rtl;
background-color: #e4e5e8;
border-radius: 5px;
display: block;
box-shadow: inset rgba(255, 255, 255, 0.75) 0px 0px 0px 1000px,
inset rgba(255, 255, 255, 0.6) 0px 1px 0px,
inset rgba(255, 255, 255, 0.4) 0px 0px 0px 1px,
rgba(0, 0, 0, 0.2) 0px 1px 3px;
}
.nitz:hover {
-webkit-box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
-moz-box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
box-shadow: 0px 0px 5px 6px rgba(251, 219, 90, 1);
background-color: #f8f8f9;
box-sizing: border-box;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.boxtitle1 {
font-weight: bold;
text-align: right;
font-size: 14px;
padding-bottom: 3px;
}
.boxtitle2 {
text-align: right;
font-size: 14px;
}
.Cellbox2 {
display: inline-block;
margin-right: 15px;
margin-bottom: 15px;
vertical-align: top;
margin-top: 20px;
}
<a href="https://www.google.com" rel="">
<div class="nitz">
<div class="Cellbox2">
<div class="boxtitle1">That is a big test</div>
<div class="boxtitle2">That is a small one</div>
</div>
</div>
</a>
The over Divs are:
ipsWidget ipsWidget_vertical ipsBox
ipsWidget ipsWidget_vertical ipsBox
and
ipsList_reset
above all that divs.
The css of that divs are:
/* Blocks - styles for various widgets */
.ipsWidget {
position: relative;
padding: 0;
background: #fff;
}
.ipsWidget.ipsWidget_vertical {
margin-top: 15px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_title {
padding: 10px;
margin: 0;
font-size: 14px;
font-weight: 400;
position: relative;
color: #fff;
background: {theme="widget_title_bar"};
border-radius: 2px 2px 0px 0px;
}
.ipsWidget_inner{
padding: 10px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_inner {
color: #575757;
}
.ipsWidget.ipsWidget_horizontal {
padding: 0 0 10px 0;
}
.ipsWidget.ipsWidget_horizontal:not( .ipsWidgetHide ) + .ipsWidget {
margin-top: 10px;
}
.ipsWidget.ipsWidget_horizontal .ipsWidget_title {
font-weight: 400;
margin-bottom: 10px;
background: #f5f5f5;
padding: 10px;
}
.ipsWidget.ipsWidget_vertical .ipsWidget_inner {
color: #575757;
}
.ipsWidget.ipsWidget_horizontal .ipsTabs {
margin: -5px 0 5px 0;
}
.ipsWidget.ipsWidget_horizontal .ipsTabs_panel {
background: #fff;
margin: 0;
}
.ipsWidget_columns > [class*="ipsGrid"] {
margin-bottom: 0;
border-bottom: 0;
}
html[dir="ltr"] .ipsWidget_columns > [class*="ipsGrid"] {
border-right: 1px solid rgba(0,0,0,0.1);
padding-right: 10px;
}
html[dir="rtl"] .ipsWidget_columns > [class*="ipsGrid"] {
border-left: 1px solid rgba(0,0,0,0.1);
padding-left: 10px;
}
html[dir="ltr"] .ipsWidget_columns > [class*="ipsGrid"]:last-child {
border-right: 0;
}
html[dir="rtl"] .ipsWidget_columns > [class*="ipsGrid"]:last-child {
border-left: 0;
}
.ipsWidget_horizontal .ipsWidget_statsCount {
font-size: 22px;
line-height: 32px !important;
font-weight: 300;
}
.ipsWidget_horizontal .ipsWidget_stats {
margin-top: 15px;
}
.ipsWidget .ipsTabs_small {
padding: 0;
background: transparent;
}
.ipsWidget .ipsTabs_small .ipsTabs_item:not( .ipsTabs_activeItem ) {
color: rgba(50,50,50,0.6);
border-bottom: 1px solid transparent;
}
.ipsWidget .ipsTabs_small .ipsTabs_activeItem {
border-bottom: 1px solid rgba(0,0,0,0.25);
}
.ipsWidget .ipsDataItem_title {
font-size: 13px;
}
.ipsWidget.ipsWidget_primary {
background: #262e33;
}
.ipsWidget.ipsWidget_primary h3 {
color: #fff;
}
html[dir="ltr"] .ipsWidget_latestItem {
margin-left: 85px;
}
html[dir="rtl"] .ipsWidget_latestItem {
margin-right: 85px;
}
.ipsWidgetBlank {
margin-top: 16px;
padding-top: 30px;
}
I'm pretty sure the problem does not come from the code you linked.
Rather i guess that your button is on the border of a overflow : hidden div and the shadow falls outshide that div.
Or there is another invisible div beside the button hidding the shadow.
Look at that snippet and notice why part of the shadow doesn't show : The button is on the top right corner of the parent (".test") div.
I cannot check your code but i guess the problem comes from a parent div (maybe because you haven't fixed a width and it is stopping right after the button)
.test {
display: block
width: 400px;
height: 200px;
overflow: hidden;
}
.nitz {
font-family:sans-serif;
font-size: 0;
float: right;
width:300px;
height:76px;
direction:rtl; background-color:#e4e5e8;border-radius: 5px;
display:block;
box-shadow: inset rgba(255,255,255,0.75) 0px 0px 0px 1000px,
inset rgba(255,255,255,0.6) 0px 1px 0px,
inset rgba(255,255,255,0.4) 0px 0px 0px 1px, rgba(0,0,0,0.2) 0px 1px 3px;
}
.nitz:hover {-webkit-box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
-moz-box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
box-shadow: 0px 0px 5px 6px rgba(251,219,90,1);
background-color:#f8f8f9;
box-sizing: border-box;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.boxtitle1 {font-weight: bold;text-align:right; font-size:14px; padding-bottom:3px;}
.boxtitle2 {text-align:right; font-size:14px;}
.Cellbox1
{width:50px; height:50px; display:inline-block; margin-bottom:15px; margin-right:15px; margin-top:15px; }
.Cellbox2
{display:inline-block; margin-right:15px; margin-bottom:15px; vertical-align:top; margin-top:20px;}
<div class="test">
<a href="https://www.google.com" rel="">
<div class="nitz">
<div class="Cellbox2">
<div class="boxtitle1">That is a big test</div>
<div class="boxtitle2">That is a small one</div>
</div>
</div>
</a>
</div>
You can add some padding to the parent "anchor" tag with some classname
.some-class-name {
padding: 0 15px;
display: inline-block;
box-sizing: border-box;
}
I am building a very simple form using this tutorial.
I need to control fields individually in CSS.
Right now if i mess with one field, the rest of the fields are affected as well.
How can i do that?
Form html:
<form name="contactform" class="contact_form" method="post" name="contact_form" action="send_form_email.php">
<ul>
<li>
<label for="name"></label>
<input type="text" placeholder="John Doe" required />
</li>
</ul>
<ul id="telephone">
<li>
<label for="telephone"></label>
<input type="text" placeholder="John Doe" required />
</li>
</ul>
</form>
Form CSS:
/* === Remove input autofocus webkit === */
*:focus {outline: none;}
/* === Form Typography === */
body {font: 14px/21px "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", sans-serif;}
.contact_form h2, .contact_form label {font-family:Georgia, Times, "Times New Roman", serif;}
.form_hint, .required_notification {font-size: 11px;}
/* === List Styles === */
.contact_form ul {
width:750px;
list-style-type:none;
list-style-position:outside;
margin:0px;
padding:0px;
}
.contact_form li{
padding: 12px;
border-bottom: 1px solid #eee;
position: relative;
margin-left: -180px;
margin-top: 20px;
}
.contact_form li:first-child, .contact_form li:last-child {
border-bottom:1px solid #777;
}
/* === Form Header === */
.contact_form h2 {
margin:0;
display: inline;
}
.required_notification {
color:#d45252;
margin:5px 0 0 0;
display:inline;
float:right;
}
/* === Form Elements === */
.contact_form label {
width:150px;
margin-top: 3px;
display:inline-block;
float:left;
padding:3px;
}
.contact_form input {
height: 20px;
width: 180px;
padding: 5px 8px;
}
.contact_form textarea {padding:8px; width:300px;}
.contact_form button {margin-left:156px;}
/* form element visual styles */
.contact_form input, .contact_form textarea {
border:1px solid #aaa;
box-shadow: 0px 0px 3px #ccc, 0 10px 15px #eee inset;
border-radius:12px;
padding-right:30px;
-moz-transition: padding .25s;
-webkit-transition: padding .25s;
-o-transition: padding .25s;
transition: padding .25s;
}
.contact_form input:focus, .contact_form textarea:focus {
background: #fff;
border:1px solid #555;
box-shadow: 0 0 3px #aaa;
padding-right:70px;
}
/* === HTML5 validation styles === */
.contact_form input:required, .contact_form textarea:required {
background: #fff url(images/red_asterisk.png) no-repeat 98% center;
}
.contact_form input:required:valid, .contact_form textarea:required:valid {
background: #fff url(images/valid.png) no-repeat 98% center;
box-shadow: 0 0 5px #5cd053;
border-color: #28921f;
}
.contact_form input:focus:invalid, .contact_form textarea:focus:invalid {
background: #fff url(images/invalid.png) no-repeat 98% center;
box-shadow: 0 0 5px #d45252;
border-color: #b03535
}
/* === Form hints === */
.form_hint {
background: #d45252;
border-radius: 3px 3px 3px 3px;
color: white;
margin-left:8px;
padding: 1px 6px;
z-index: 999; /* hints stay above all other elements */
position: absolute; /* allows proper formatting if hint is two lines */
display: none;
}
.form_hint::before {
content: "\25C0";
color:#d45252;
position: absolute;
top:1px;
left:-6px;
}
.contact_form input:focus + .form_hint {display: inline;}
.contact_form input:required:valid + .form_hint {background: #28921f;}
.contact_form input:required:valid + .form_hint::before {color:#28921f;}
/* === Button Style === */
button.submit {
background-color: #68b12f;
background: -webkit-gradient(linear, left top, left bottom, from(#68b12f), to(#50911e));
background: -webkit-linear-gradient(top, #68b12f, #50911e);
background: -moz-linear-gradient(top, #68b12f, #50911e);
background: -ms-linear-gradient(top, #68b12f, #50911e);
background: -o-linear-gradient(top, #68b12f, #50911e);
background: linear-gradient(top, #68b12f, #50911e);
border: 1px solid #509111;
border-bottom: 1px solid #5b992b;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
box-shadow: inset 0 1px 0 0 #9fd574;
-webkit-box-shadow: 0 1px 0 0 #9fd574 inset ;
-moz-box-shadow: 0 1px 0 0 #9fd574 inset;
-ms-box-shadow: 0 1px 0 0 #9fd574 inset;
-o-box-shadow: 0 1px 0 0 #9fd574 inset;
color: white;
font-weight: bold;
padding: 6px 20px;
text-align: center;
text-shadow: 0 -1px 0 #396715;
}
button.submit:hover {
opacity:.85;
cursor: pointer;
}
button.submit:active {
border: 1px solid #20911e;
box-shadow: 0 0 10px 5px #356b0b inset;
-webkit-box-shadow:0 0 10px 5px #356b0b inset ;
-moz-box-shadow: 0 0 10px 5px #356b0b inset;
-ms-box-shadow: 0 0 10px 5px #356b0b inset;
-o-box-shadow: 0 0 10px 5px #356b0b inset;
}
Add a class name to your input tag, so instead of selecting:
.contact_form input {...}
you could do:
.contact_form input.telephone {...}
and your html would look like this:
<input type="text" class="telephone" placeholder="John Doe" required />
One way:
Give each field you want to control a unique id:
<input id="input1" />
Then in your css, address it like so:
#input1
{
style: value;
}
Your input tags will probably end up with name attributes:
<input type="text" name="telephone">
So you can reference them like so:
input[name=telephone] { ...
Both of the answers already here would work. You can specifically select any HTML element to style in CSS with IDs or Classes. However, the two are very different things. Read up on the difference here.
HTML:
<input id="myUniqueID" class="myClass" />
<input id="myOtherID" class="myClass" />
CSS:
input { color: black; background: white; }
input#myUniqueID { color: red; }
input.myClass { background: blue; }
Output:
You have two input elements and you have globally styled them with black text and white backgrounds. However, you have also given them IDs and Classes to help them stand out. IDs must be unique, so there can only be one of them. With this CSS, the first element will therefor have red text while the second will still have black text. Even though it is given a separate ID, it isn't used for anything and that's okay. Classes can select multiple elements, so both of the inputs will have blue backgrounds rather than white ones.
I am trying to replicate as pixel perfect as I can get and im having trouble trying to do the shadow on the right. Is this possible with css?
CSS:
*{margin:0px;padding:0px;}
html {
width:100%;
height:100%;
text-align: center;
}
.bold {
font-weight:700;
}
#ribbon {
padding: .34em 1em;
margin: 0;
margin-top: 5%;
position:relative;
color: #000;
text-align: center;
letter-spacing:0.1em;
padding-top:12px;
padding-bottom:12px;
display: inline-block;
background: #ffd82b;
z-index:100;
box-shadow: 0 7px 0px -2px #ebeced;
}
#ribbon:after {
content: "";
width:3.2em;
bottom:-.5em;
position:absolute;
display:block;
border: .9em solid #ffd82b;
box-shadow: 0 7px 0px -2px #ebeced;
z-index:-2;
}
#ribbon:after {
right: -4.3em;
border-left-width: .75em;
border-right-color:transparent;
}
#content:after {
content:"";
bottom:-.5em;
position:absolute;
display:block;
border-style:solid;
border-color: #fc9f42 transparent transparent transparent;
z-index:-1;
}
#content:before {
content:"";
top:-.5em;
transform: rotate(90deg);
position:absolute;
display:block;
border-style:solid;
border-color: #fc9f42 transparent transparent transparent;
z-index:-1;
}
#content:before {
left: 0;
border-width: .5em 0 0 .5em;
}
#content:after {
right: 0;
border-width: .5em .5em 0 0;
}
HTML:
<div id="ribbon">
<span id="content"><span class="bold">Special Offer:</span> Recieve bonus rewards points for signing up</span>
</div>
Or here's a jsfiddle:
http://jsfiddle.net/k0a6jhv6/
You can make this ribbon without using box-shadows, only with borders, z-index and pseudo elements :
DEMO
output :
.ribbon{
font-size:20px;
position:relative;
display:inline-block;
margin: 2em 1em;
text-align:center;
}
.text{
display:inline-block;
padding:0.5em 1em;
min-width:20em;
line-height:1.2em;
background: #FFD72A;
position:relative;
}
.ribbon:after,.ribbon:before,
.text:before,.text:after,
.bold:before{
content:'';
position:absolute;
border-style:solid;
}
.ribbon:before{
top:0.3em; left:0.2em;
width:100%; height:100%;
border:none;
background:#EBECED;
z-index:-2;
}
.text:before{
bottom:100%; left:0;
border-width: .5em .7em 0 0;
border-color: transparent #FC9544 transparent transparent;
}
.text:after{
top:100%; right:0;
border-width: .5em 2em 0 0;
border-color: #FC9544 transparent transparent transparent;
}
.ribbon:after, .bold:before{
top:0.5em;right:-2em;
border-width: 1.1em 1em 1.1em 3em;
border-color: #FECC30 transparent #FECC30 #FECC30;
z-index:-1;
}
.bold:before{
border-color: #EBECED transparent #EBECED #EBECED;
top:0.7em;
right:-2.3em;
}
<p class="ribbon">
<span class="text"><strong class="bold">Special Offer:</strong> Recieve bonus rewards points for signing up</span>
</p>
What if you add a new element to create missing shadow?
#abc {
display:inline-block;
border: .9em solid #ebeced;
border-right-color:transparent;
position:absolute;
right:-73px;
z-index:-3;
bottom:-12px;
}
http://jsfiddle.net/k0a6jhv6/9/
another solution, use span:after inside #content
#content span:after {
content:'';
display:block;
border: .9em solid #ebeced;
border-right-color:transparent;
position:absolute;
right:-73px;
z-index:-3;
bottom:-12px;
}
http://jsfiddle.net/k0a6jhv6/11/
I've got the CSS code for my register button:
.register-button {
padding:7px 375px;
background: #3b7aae;
border-radius: 5px;
border: none;
box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 1px 0 1px rgba(255,255,255,.25);
color: #fff;
font-weight: bold;
cursor: pointer;
cursor: hand;
font-size: 20px;
text-decoration: none;
position:absolute;
bottom:-100px;
left:0px;
text-align:left;
text-shadow:2px 2px rgba(0,0,0,.3);
}
.register-button:hover {
background-color: #4386be;
}
.register-button span {
display:block;
font-weight:normal;
}
And the HTML looks like:
<a class="register-button" href="/register">
Register today, you won't regret it!
</a>
It then outputs this:
My question is simple, how can I get it to stay on one single line, rather than like how it is in the picture? I've tried changing the position to fixed and adjusting top; & left; and it just made things worse.
Set the width of the .register-button to 300px.
Here is a jsFiddle example using your code (http://jsfiddle.net/2WCje/)
CSS:
.register-button {
padding:7px 375px;
background: #3b7aae;
border-radius: 5px;
border: none;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), inset 0 1px 0 1px rgba(255, 255, 255, .25);
color: #fff;
font-weight: bold;
cursor: pointer;
cursor: hand;
font-size: 20px;
text-decoration: none;
position:absolute;
bottom:-100px;
left:0px;
text-align:left;
text-shadow:2px 2px rgba(0, 0, 0, .3);
width: 300px;/*----------This will line up the text for you-----------*/
}
.register-button:hover {
background-color: #4386be;
}
.register-button span {
display:block;
font-weight:normal;
}
Reduce your padding value from
.register-button {
padding:7px 375px;
to something like this
.register-button {
padding:7px 35px;
I have an input box and a button on a website which i'm trying to align correctly in my CSS. Initially it looked fine on firefox 22.0, safari 5.1.9 and chrome 29.0.1547.57(mac) but not chrome 28.0.1500.95 on windows so i added some code that only targeted chrome , however now it looks odd in safari and chrome (mac) but fine in firefox and chrome on windows. How would i fix this?
This is what happens: http://i754.photobucket.com/albums/xx182/rache_R/image_zpsd746de67.jpg
CSS code:
input#image {
position: relative;
top: 20px;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
input#image {
position: relative;
top: -2px;
left: 106px;
}
}
input#box {
position: relative;
width: 30px;
height: 25px;
top: 25px;
left: -60px;
border:none;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 5px #666 inset;
-moz-box-shadow:0 0 5px #666 inset;
box-shadow:0 0 5px #666 inset;
text-align: center;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
input#box {
position: relative;
width: 30px;
height: 25px;
top: 30px;
left: -60px;
border:none;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 5px #666 inset;
-moz-box-shadow:0 0 5px #666 inset;
box-shadow:0 0 5px #666 inset;
text-align: center;
}
}
try make this
css
*{
padding: 0;
margin: 0;
outline: 0;
}
#first {
}
#first li {
list-style-type: none;
float: left;
}
#first li a {
background-color: #333333;
display: block;
margin: 1px;
padding: 5px;
color: #CCCCCC;
text-decoration: none;
font-family: Tahoma;
}
#first li a:hover {
background-color: #666666;
}
html
<ul id="first">
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>