Ribbon across container in Bootstrap 3 not working - css

I'm not quite sure what I'm doing wrong here.
I'm trying to apply a ribbon across a container using the example on this site:
http://www.andreapinchi.it/css3-ribbon-effect/
I've created a mock-up of the problem here:
http://jsbin.com/rebexatijizi/1/edit
Doesn't look much like the other. :(
*NOTE: JSBIN link updated above to show current status.

DEMO: http://jsbin.com/tibaqenawena/4/edit
CSS:
.ribbon, .ribbon:before, .ribbon:after {box-sizing:content-box;}
You can also just adjust the math in your css to include padding and borders. DEMO: http://jsbin.com/dupac/1/edit
div.both_ribbon::before{
display: block;
width: 10px;
height: 0px;
position: absolute;
bottom: -10px;
left: -2px;
content: "";
border-bottom: 10px solid transparent;
border-right: 10px solid rgb(0, 80, 116);
}
div.both_ribbon::after{
display: block;
width: 10px;
height: 0px;
position: absolute;
bottom: -10px;
right: -2px;
content: "";
border-bottom: 10px solid transparent;
border-left: 10px solid rgb(0, 80, 116);
}
Also, your css is messed up and it still is, you have a enclosed a style within another style.

Your box-sizing properties seem to be messing everything up. In bootstrap.css remove the box-sizing rules. Also, take the padding off of your container (you can add another child element within your container that has padding instead). Here is the code you should remove:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
:before, :after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

Related

How to fix input paddig in HTML5

I have a problem with padding in HTML5. I'm using this code:
input[type="password"] {
border: 1px solid #CECECE;
border-radius: 0 0 3px 3px;
padding: 7px;
font-size: 1em;
outline: none;
width: 100%;
margin: 0px;}
I use inputs in div, which has padding 10px.
And when I'm testing code the width of input is not right, look at this pic:
How to solve this problem? I want to have padding 10px in any window size.
Add this CSS :
input {
-moz-box-sizing:border-box;
-webkit-box-sizing: border-box;
box-sizing:border-box;
}
This property will include padding and border to the width/height of inputs so they won't overflow anymore.
Use:
box-sizing:border-box;
-moz-box-sizing:border-box;
in your css file.
input[type="password"] {
border: 1px solid #CECECE;
border-radius: 0 0 3px 3px;
padding: 7px;
font-size: 1em;
outline: none;
width: 100%;
margin: 0px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
/* apply a natural box layout model to all elements */
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
http://fiddle.jshell.net/yTM9U/2/
You need to set the CSS style margin-right for the input.
input {
margin-right: 10px;
}
Padding is a cushioning/space inside the element. To push an element away from
surrounding elements internal cushioning/padding-space cannot help. Margin needs
to be set for those purposes...
But in your case, r/l to the form width, inputs are already very wide (100%). So, you need to decrease the width of the inputs. Try
input {
width: 90%;
max-width: 90%;
}

Block Borders Using Bootstrap

I have a sidebar block using bootstrap with two image blocks, one on top of the other, and my client wants a glowing red border around the blocks. I have a black background and the border for the glow. Here is the problem, when I resize the browser to a tablet size, the black background and border are wider than the image and the image is not centered. I want the border and glow to be 10px around the image and centered in the screen, not to the left. If I use a transparent background the image is to the left and the red border spans the whole screen and once again looks bad. Here are two screenshots:
I want the images to resize and be next to each other like other responsive templates with the glow and nothing I try is working. This is all probably pretty simple but I am lost. I am learning but this is driving me crazy. I have applied some additional css through c5 to give a glow to the images in the block. This is the code that comes up when I use Chrome dev tools:
element.style { }
#blockStyle167Sidebar40 {
background-repeat: no-repeat;
background-color: #000000;
-webkit-box-shadow: 0 0 6px 4px rgba(255,0,0,.7);
box-shadow: 0 0 6px 4px rgba(255,0,0,.7);
padding: 10px;
}
.pic {
border: 1px solid #000000;
height: 245px;
width: 370px;
overflow: hidden;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 10px;
margin-left: 0px;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
user agent stylesheetdiv {
display: block;
}
Inherited from div#sidebar-wrap.span4.sidebar-wrap.sidebar.color-content.pad
#main-content .color-content {
color: #FFFFFF;
}
Inherited from div.row-fluid.has-sidebar
#page .row-fluid {
color: #ffffff;
I am sorry this is so long but my site is in maintenance mode and I don't know how to link the page. I could give someone acces so the can look at it.
Thanks for any help.
Essentially what you need to do is create a transparent border of 10px with a red box shadow.
img {
border: 10px solid transparent;
box-shadow: 0px 0px 15px 0px rgba(255,0,0,1);
}
Then set each of the images to the width % you want.
See this jsfiddle http://jsfiddle.net/TZh2Y/

2 divs have about 1px gap in IE 11

IE 10 and 11 hasn't disappointed me so much when it comes to css until today . .
The class base and triangle has about 1px gap in between in IE 9 - 11. The other 4 browsers are not showing the gap.
.base {
display: inline-block;
position: absolute;
bottom: 5px;
right: -8px;
background-color: #ffcc00;
color: #5A5A5A;
font-size: 12px;
font-weight: bold;
padding: 2px 5px;
text-decoration: none;
margin:0;
}
.triangle {
width: 0px;
height: 0px;
border-style: solid;
border-width: 10px 0 0 11px;
border-color: transparent transparent transparent #DBB004;
display: inline-block;
position: absolute;
bottom: 24px;
right: -8px;
margin:0;
z-index: -1;
}
Here's a FIDDLE
This is not a bug. This is the correct rendering of display: inline-block; elements by the browser. The browser spaces inline-block elements using a width equal to a single white space character of the font (therefore, the larger the font, the wider the gap).
You can read how to solve this issue at CSS Tricks here. However, generally a negative margin-left of -4px (if your body font size is 16px) will remove the white space. For example:
.element {
display: inline-block;
}
.element ~ .element {
margin-left: -4px;
}
Edit
A better way of handling the white-space is to set font-size: 0; on the parent element and reset the font-size: 18px; or whatever your body font-size is on each of the elements with display: inline-block; elements`. This will handle browser zooming and hires displays better than the method I described above. Obviously, this strategy sometimes require an additional parent element, which might break your layout styling.
Change the .triangle margin to -1px.
Another way of solving it, is by putting the triangle inside the base-element. Easiest would to replace it with an ::after pseduo-element.
.base::after {
content: '';
width: 0px;
height: 0px;
border-style: solid;
border-width: 10px 0 0 11px;
border-color: transparent transparent transparent #DBB004;
display: inline-block;
position: absolute;
top: -10px;
right: 0px;
margin:0;
z-index: -1;
}
http://jsfiddle.net/WrVYd/21/

Weird position issue w/ custom styled select in Firefox

I am trying to obtain a pure CSS select input with an arrow. All is well except Firefox is causing some weird issue and pushing the arrow past the width of the box.
You can see it here: http://cssdeck.com/labs/xvvfgv3k (Please view in a FF browser)
Is this some sort of bug? When viewing the css in Firebug to try and fix the problem, it fixes itself and displays how it should. Really weird. Any help is greatly appreciated. Thanks!
Try making your select element relative and adjusting the right property on your :before and :after pseudo elements.
Try this
.wrap {
width: 200px;
margin: 10% auto;
font-size: 14px;
}
select {
width: 100%;
padding:10px;
margin: 0;
border: 1px solid #bec1c3;
border-radius:0;
background: #fff;
color:#888;
line-height: 1;
outline:none;
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
cursor:pointer;
position: relative;
}
span.select {
position:relative;
padding: 9px 0;
}
span.select:after {
content:'';
width: 0px;
height: 0px;
border-style: solid;
border-width: 6px 4px 0 4px;
border-color: #bec1c3 transparent transparent transparent;
position: absolute;
right: 16px;
top: 14px;
pointer-events: none;
z-index: 100;
}
span.select:before {
content: '';
display: block;
right: 6px;
top: 0;
width: 34px;
height: 34px;
background: #F7F7F7;
position: absolute;
pointer-events: none;
z-index: 99;
}
Saucelabs shows the following browsers also show the bug you refer to :
1. Firefox 25 on windows7
2. Firefox 20 on windows7
3. Firefox 10 on windows7
4. Firefox 25 on Linux
Does this link help?
Firefox button and text input bug

Double Line Behind Header Stops Working When Bootstrap Applied

The stack overflow community helped me figure out how to add two different sized lines behind my section title on my website. The method can be viewed in this JS Fiddle: http://jsfiddle.net/dCZR4/1/
It was working properly, until I included the Twitter Bootstrap 3.0 CSS in my layout. Now, the two lines appear right on top of each other, making one thick line behind the text. This can be seen here: http://onedirectionconnection.com/tester/
If anybody could advice me on what could be causing this hiccup, it would be greatly appreciated.
The CSS for the header is below:
.section-title{
font-family: 'Lato', 'Asap','Quicksand', 'Droid Sans', sans-serif;
position: relative;
font-size: 30px;
z-index: 1;
overflow: hidden;
text-transform: uppercase;
text-align: center;
}
.section-title:before, .section-title:after {
position: absolute;
top: 40%;
overflow: hidden;
width: 50%;
height: 4px;
content: '\a0';
border-bottom: 3px solid #DA5969;
border-top: 1px solid #DA5969;
}
.section-title:before {
margin-left: -52%;
text-align: right;
}
.section-title:after {
margin-left:2%;
text-align:left;
}
And the HTML is:
<div class="section-title">Title Goes Here</div>
(In the JSFiddle, it is simply defined as h1, but I changed it in my layout)
Thanks in advance for any help offered!
Bootstrap applies the box-sizing: border-box by default.
You would need to reset that to box-sizing:content-box for this particular requirement.
.section-title:before, .section-title:after {
position: absolute;
top: 40%;
overflow: hidden;
width: 50%;
height: 4px;
content: '\a0';
border-bottom: 3px solid #DA5969;
border-top: 1px solid #DA5969;
box-sizing: content-box; /* + vendor specific versions here */
}

Resources