What CSS method would remove an outline of a div cross browser - html

I have two divs that join together that contain an image. The way the it is layered out the image is in two half's.
This works as intended but only views correctly in chrome. In the other browsers there is an outline or some layout error which causes the document to look different.
I presumed that outline:0; and border:0; would do the trick.
This is how the image should look. This is taken form chrome. As you can see there is nothing visually wrong with this.
Internet Explore
FireFox
Safari
CSS:
.login{
position:absolute;
left:50%;
margin-left:-150px;
top:50%;
margin-top:-200px;
width:300px;
height:400px;
border-radius:10px;
text-align:center;
display:table-cell;
vertical-align:central;
padding:0 0 0 0;
border:0;
border-style:none;
outline:0;
}
.login header{
height:75px;
width:100%;
margin-bottom:0;
padding:0 0 0 0;
border-style:none;
outline:0;
border:0;
}
.login header .logo{
width:150px;
height:75px;
outline:none;
margin-left:75px;
border:0;
border-style:none;
outline:0;
background:url(assests/logo_tiny.png) center 0px no-repeat;
background-color:#000;
border-radius:75px;
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
box-shadow:5px 5px 10px #000;
-moz-box-shadow:5px 5px 10px #000;
-webkit-box-shadow:5px 5px 10px #000;
-ms-box-shadow:5px 5px 10px #000;
-o-box-shadow:5px 5px 10px #000;
}
.login form{
outline:none;
width:100%;
height:245px;
padding:0 0 0 0;
padding-top:80px;
border:0;
border-style:none;
box-shadow:5px 5px 10px #000;
background:url(assests/logo_tiny.png) center -75px no-repeat;
background-color:#000;
-moz-box-shadow:5px 5px 10px #000;
-webkit-box-shadow:5px 5px 10px #000;
-ms-box-shadow:5px 5px 10px #000;
-o-box-shadow:5px 5px 10px #000;
border-radius:10px;
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
color:#FFF;
}
HTML:
<div class="login">
<header>
<div class="logo"></div>
</header>
<form>
</form>
</div>
Update: Fiddle

You made a mistake by flattening your logo.
It was 150px wide and only 75px high. Besides you've removed the border-radius at the bottom. On order to have a circle cast a circular shadow the whole div has to be square and the border-radius have to be equal.
See attached fiddle.
http://jsfiddle.net/mbh6W/2/
So the line you saw was in fact the box shadow of the circle that was flattened at the bottom.

Related

CSS triangle with inset shadow

I've made a "triangle" using CSS using the code outlined HERE
(jsFiddle example)
It works great, but I would like to have an inset shadow on the triangle and bar like this:
How?
HTML:
<div id="wrapper">
<div class="triLeft"></div>
<div class="triAngle"></div>
</div>
CSS:
.triLeft{
width:40px;
background:#fff;
margin:0;
float:left;
height:200px;
}
.triAngle{
width: 0;
height: 0;
border-style: solid;
border-width: 45px 0 45px 40px;
border-color: transparent transparent transparent #ffffff;
float:left;
margin-top:20px;
}
#wrapper{
height:200px;
background:brown;
}
you could try it another way, without borders but transform:rotate();
http://codepen.io/anon/pen/MymQMK
div.trgl {
position:relative;
margin:2em;
overflow:hidden;
}
div.trgl:after {
content:'';
position:absolute;
height:40px;
width:40px;
top:2em;
left:-20px;
background:white;
box-shadow: inset 0 0 5px black ;
transform:rotate(45deg);
}
div.trgl div{
position:relative;
min-height:200px;
padding:1em;
box-shadow: 0 0 5px black;
margin:3px;
background:lightgray;
}
<div class="trgl">
<div>
</div>
</div>

Place a DIV side by side with a SPAN, inside another DIV

I need to place the promo div in the right side of the alert div, just like this:
Please, can some CSS expert help me with this code: https://jsfiddle.net/08rnpxbt/4/
body {
width:640px;
float:left;
margin:0 6px 0 6px;
padding:18px;
font-family:Arial, Helvetica, sans-serif;
}
p {
padding:0;
margin:8px 0 0 0;
}
div.alert {
padding:8px 12px 8px 12px;
margin:20px auto 20px auto;
text-align:justify;
border:2px solid #389CF2;
border-radius:8px;
background-color:#F5F5F5;
background-image:url(http://i61.tinypic.com/1oxi50.png);
background-repeat:no-repeat;
background-position:8px 11px;
}
div.alert span {
display:block;
//float:left;
padding-bottom:2px;
margin-left:40px;
font-size:15px;
line-height:1.3em;
color:#5C5C5C;
}
div#promo {
display:block;
width:80px;
height:32px;
padding:4px 2px 2px 2px;
text-align:center;
line-height:15px;
font-size:14px;
color:#FF0000;
border:2px dotted #585858;
border-radius:16px;
background-color: #FFFFD5;
}
<body>
<div class="alert" style="width:530px; margin:0 auto 10px auto;">
<span>
<b>Windows 7 Home Premium - 02 License(s)</b><br>
Price: U$ 225.00 up to 10X or R$ 210.00 in cash
</span>
<div id="promo">15,00% de desconto !</div>
</div>
</body>
Just add this CSS rule to your #promo element:
#promo{
float: right;
}
and change this in your CSS:
div.alert span{
display: inline-block;
}
If you don' set inline-block the #promo will break in new line like you had it before.
Try it here
You can use flexbox attribute for this
just add display:flex and justify-content:space-between
div.alert {
display:flex;
justify-content:space-between;
padding:8px 12px 8px 12px;
margin:20px auto 20px auto;
text-align:justify;
border:2px solid #389CF2;
border-radius:8px;
background-color:#F5F5F5;
background-image:url(http://i61.tinypic.com/1oxi50.png);
background-repeat:no-repeat;
background-position:8px 11px;
}

Display two divs inline

I need to display two divs one next to another on the same line, but I can't understand why the second one is slightly lower than the first one.
<div class="cont-title">
<div class="triang-header"></div>
<div class="h2-stripe">
<h2 itemprop="name">
Title
</h2>
</div>
</div>
This is the css:
.cont-title{
margin-right: -7px;
min-width: 90%;
max-width: 100%;
height:51px;
float:right;
text-align:right;
white-space: nowrap;
}
.triang-header{
position:relative;
width:39px;
height:38px;
display:inline-block;
background:url('../images/titlebar.png') no-repeat top left;
}
.h2-stripe{
position:relative;
z-index:10;
display:inline-block;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
line-height:38px;
box-shadow: 2px 3px 5px 0 #555;
}
What am I doing wrong?
I think you did not count the line-height,
should be like this the style for .h2-stripe:
.h2-stripe{
position:relative;
line-height: 23px; // <----
z-index:10;
display:inline-block;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
box-shadow: 2px 3px 5px 0 #555;
}
here it is an example with line-height:23px for .h2-stripe: http://jsfiddle.net/6a0ga3uq/
you misspelled your class
.h2-strispe{
position:relative;
z-index:10;
display:inline-block;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
line-height:38px;
box-shadow: 2px 3px 5px 0 #555;
}
should be
.h2-stripe{
position:relative;
z-index:10;
display:inline-block;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
line-height:38px;
box-shadow: 2px 3px 5px 0 #555;
}
The margin of your h2 element causes the second div to shift down. Also, you should vertical-align inline-block elements. See this updated snippet (also with corrected class name in CSS).
.cont-title{
margin-right: -7px;
min-width: 90%;
max-width: 100%;
height:51px;
float:right;
text-align:right;
white-space: nowrap;
}
.cont-title > * {
vertical-align: middle;
}
.triang-header{
position:relative;
width:39px;
height:38px;
display:inline-block;
background:url('http://placehold.it/39x38') no-repeat top left;
margin: 0;
}
.h2-stripe{
position:relative;
z-index:10;
display:inline-block;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
line-height:38px;
box-shadow: 2px 3px 5px 0 #555;
}
h2 {
margin:0;
}
<div class="cont-title">
<div class="triang-header"></div><div class="h2-stripe"><h2 itemprop="name">
Title
</h2>
</div>
</div>
In the second div, you have line height and lot of other stuff. So other elements can extend your div. If you want your div to be the same size regardless to its other elements you should change display attribute like this
.h2-strispe{
position:relative;
z-index:10;
display:inline-block;
box-sizing:border-box;
text-align:left;
background-color: #2A58AE;
margin:0;
height:38px;
min-width:80%;
line-height:38px;
box-shadow: 2px 3px 5px 0 #555;
}
You can see i added box-sizing to border-box and that will save the position of your div no matter what you do to inner elements

How to center a div within a div? (margin: 0 auto; not working)

I have a div that is going to be used as a button, but it doesn't want to center within the larger div!
This is my CSS for the larger div:
.news-quarters{
width:189px;
height:300px;
position:relative;
float:left;
padding:10px;
padding-top:0px;
margin:10px;
text-align:left;
}
and for the button div:
.green-button{
width:auto;
height:auto;
position: relative;
float:none;
padding:0px;
margin: 0 auto;
background: #0A9C00;
background-size:auto;
border:1px outset #0A9C00;
border-radius: 3px;
-webkit-box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
-moz-box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
overflow:auto;
display:inline-block;
}
.green-button h4{
text-align:center;
color:white;
line-height:1;
margin:0px;
font-size:12px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
width:auto;
}
And my html like this:
<div class="news-quarters">
<div class="green-button">
<h4>Insert button text here</h4>
</div>
</div>
Can someone please help? This is severely p***ing me off :(
Thank you!
In the style .news-quarters change text-align:left to text-align:center;
There are already many existing answers for this problem see How to horizontally center a <div> in another <div>?

Why is my main content div not extending to fit child divs inside of it?

I've been working on a new website with a modern-ish look. I wanted to have two columns inside of a single content div. However, after hours of trial and error with various bit of code I've found online, I come to no avail.
My HTML looks like this:
<!DOCTYPE html>
<html>
<head>
<title>Unnamed Website</title>
<link rel="stylesheet" href="../_css/websitename.css" type="text/css">
</head>
<body>
<div id="wrap">
<div id="header">
<div id="logo">
</div>
<div id="nav">
<ul>
</ul>
</div>
</div>
<div id="content">
<h2>Header Level Two</h2>
<div id="columnleft">
Hello
</div>
<div id="columnright">
Hello
</div>
</div>
<div id="footer">
<p>Copyright © 2013 BlahBlahBlah.com</p>
</div>
</div>
</body>
</html>
I honestly don't see anything wrong with the HTML. However, the CSS is where it gets confusing:
body{
background-color:#333333;
font-family:Helvetica;
}
div#wrap{
width:1000px;
height:auto;
margin-top:20px;
margin-right:auto;
margin-left:auto;
}
div#header{
width:980px;
height:130px;
margin-top:10px;
margin-right:auto;
margin-left:auto;
}
div#content{
background-color:#ffffff;
border-color:#ffffff;
border-width:1px;
border-style:solid;
border-top-left-radius:5px;
-moz-border-top-left-radius:5px;
-webkit-border-top-left-radius:5px;
-o-border-top-left-radius:5px;
border-top-right-radius:5px;
-moz-border-top-right-radius:5px;
-webkit-border-top-right-radius:5px;
-o-border-top-right-radius:5px;
width:950px;
height:auto;
margin-right:auto;
margin-left:auto;
padding:0 15px;
}
div#footer{
background-color:#eeeeee;
border-color:#eeeeee;
border-width:1px;
border-style:solid;
border-bottom-left-radius:5px;
-moz-border-bottom-left-radius:5px;
-webkit-border-bottom-left-radius:5px;
-o-border-bottom-left-radius:5px;
border-bottom-right-radius:5px;
-moz-border-bottom-right-radius:5px;
-webkit-border-bottom-right-radius:5px;
-o-border-bottom-right-radius:5px;
width:980px;
height:40px;
margin-bottom:10px;
margin-right:auto;
margin-left:auto;
box-shadow:5px 2px 10px #333333;
clear:both;
}
#footer p{
text-align:center;
font-family:Helvetica;
font-size:13;
line-height:7px;
}
h2{
background-color:#35586c;
font-family:Helvetica;
font-weight:bold;
margin:15px auto;
padding:10px;
border-width:1px;
border-color:#0b0b5b;
border-style:solid;
border-radius:5px;
-o-border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
text-align:center;
box-shadow:0 0 1px #ffffff inset;
-webkit-box-shadow:0 0 1px #ffffff inset;
-moz-box-shadow:0 0 1px #ffffff inset;
-o-box-shadow:0 0 1px #ffffff inset;
text-shadow:1px 0 2px #222222;
color:#fbfffb;
}
div#columnleft{
width:200px;
height:auto;
background-color:#35586c;
font-family:Helvetica;
font-weight:bold;
margin-top:15px;
margin-bottom:15px;
margin-right:15px;
padding:10px;
border-width:1px;
border-color:#0b0b5b;
border-style:solid;
border-radius:5px;
-o-border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
text-align:center;
box-shadow:0 0 1px #ffffff inset;
-webkit-box-shadow:0 0 1px #ffffff inset;
-moz-box-shadow:0 0 1px #ffffff inset;
-o-box-shadow:0 0 1px #ffffff inset;
text-shadow:1px 0 2px #222222;
color:#fbfffb;
float:left;
}
div#columnright{
width:710px;
height:auto;
background-color:#ffffff;
font-family:Helvetica;
margin-top:15px;
margin-bottom:15px;
float:right;
text-align:justify;
}
Whenever I load up the page, the maincontent div doesn't expand with the column-divs inside it. I would like to stray away from table as much as possible so I can have better customization with each column, and I wouldn't like to use the tag. Is there any way I can fix this?
give your #content div the class="clearfix"
css like this
.clearfix:before,
.clearfix:after {
content: ".";
display: block;
height: 0;
overflow: hidden;
}
.clearfix:after {
clear: both;
}
.clearfix {
zoom: 1; /* IE < 8 */
}
here is an working example
http://jsfiddle.net/delueg/u8zvV/
the reason why it behave like this is that whenever you float elements... the parent-container loose the ability to expand corresponding to its children... that is what clearfix is for.. it clears the floats in other words..