Merge Two "DIV" and Box Shadow - merge

Is this possible to merge a round and a square div and show single box-shadow in css3? I know we can hide single side of border of any div. But my need is different:
Example Image
If this is possible, how can I achieve it?

you actually only need a single div, then can make use of positioning on its :before and :after pseudo elements (the below CSS is a starting point):
Demo Fiddle
CSS
div, div:before {
height:50px;
-webkit-box-shadow: 0 0 4px 0 #424242;
box-shadow: 0 0 4px 0 #424242;
position:relative;
margin-top:200px;
}
div:before {
height:100px;
margin-top:0;
width:100px;
display:block;
background:white;
position:absolute;
top:-25px;
left:100px;
content:'';
border-radius:100%;
}
div:after {
height:100%;
width:100%;
display:block;
background:white;
position:absolute;
top:-0;
left:0;
content:'';
}

Here i come with a very similar answer. with the use of z-index to make sure it works fine and that eventually, content is seen :)
<div class="shaped"> </div>
CSS
.shaped {
margin:2em 0;
box-shadow:0 0 5px;/* will be inherited by pseudo under */
height:2em;
position:relative;
background:white;/* will be inherited by pseudo on top */
}
.shaped:before, .shaped:after {
content:'';
position:absolute;
height:2em;
width:2em;
padding:1em;
background:inherit;
border-radius:100%;
margin:-1em 2em;
z-index:1;
}
.shaped:before {
box-shadow:inherit;
z-index:-1;
}
.shaped>* {/* let's see whatever comes inside */
position:relative;
z-index:2;
}

Related

How to make ion-select select-icon position right but just icon, select-text position left

I want it to have a standart design on ionic input elements. I have an ion-select element and this element inside select box text align-left but I want select-icon align right. I do on HTML element like that: https://ibb.co/99YXc8B. But I am not doing in the sccs style. I try a lot. Stackblitz link: https://stackblitz.com/edit/ionic-fdqf4z?file=pages%2Fhome%2Fhome.scss
Replace your CSS with this CSS code.it will works.
[inline-icon] {
font-size: 2em !important;
padding-right: 3px !important;
color: #808080ba !important;
}
.try{
color: red;
width:100%;
}
ion-select
{
max-width: 100%;
}

Form Submit Button Hover Effect Not Showing

I have a submission button for a form. I use a sprite as the background, and so on hover I shift the background over the width of my button to get the hover effect. However, this is not working.
This is my html:
<form class="a">
<All the other Fields...>
<p><input type="submit" value="Submit"/><p>
</form>
And my css:
.a input[type="submit"] {
margin-top: 15px;
background: url(btn.png) no-repeat;
width: 108px;
height: 42px;
border: none;
color: transparent;
font-size: 0;
}
.a input[type="submit"]:hover {
background: url(btn.png) no-repeat 109 0;
}
.a input[type="submit"]:hover {
background: url('btn.png') no-repeat 109px 0px; /*use 109px */
}
and check your background image path.
Background-position: for x: %|px|left|center|right and for y %|px|top|center|bottom
It could be
.a input[type="submit"]:hover {
background: url(btn.png) no-repeat;
background-position: 109px 0px; // left 109px, top 0px
}
Or
.a input[type="submit"]:hover {
background: url(btn.png) no-repeat 109px 0px;
}
Also make sure your image path is right. Right now your image should be at the same folder where your css is, according to url(btn.png).
You're missing px on your position. See this fiddle for a working example

How can I eliminate phantom margins in my dropdown menu?

I have a vertical drop-down menu that is working fairly well. I have one bug that I cannot get a handle on, though.
You can find my menu here: test Page
The menu works fine in internet explorer (except for a little drop on the first submenu, that I can live with (bonus points if you know what that's about), but in other browsers, my background flows from the submenu back to the main menu. Where the "margin" is coming from?
so far I've found that it has something to do with how I've styled my li:hover children
Potentially useful snippets from my CSS
ul#menu3{
display:block;
left:20px;
margin:0;
width:10em;
padding:0;
position:absolute;
list-style:none;
}
ul#menu3 li{
color:#000000;/*
float:left;*/
position:relative;
margin:0;/*
margin-bottom:-1px;*/
line-height:31px;
text-align:center;
width:10em;
padding:0;
font-weight:bold;
display:block;
vertical-align:middle;
background-image:url(../../../menu4/awmdata/button-tile.gif);
}
ul#menu3 li:hover ul{
text-align:center;
vertical-align:bottom;
background-image:url(../../../menu4/awmdata/button-tile.gif);
background-repeat:repeat;
left:auto;
margin-top:-31px;
}
ul#menu3 li ul{
position:absolute;
left:-999em;
margin-left:10em;
margin-top:-31px;
}
ul#menu3 li ul li{
color:#000000;
margin:0;
left:auto;
padding:0;
font-weight:bold;
}
Stick this at the top of your styles.css
ul, li {
margin: 0;
padding: 0;
}
When using unordered lists for menu's it's always a good idea to remove the margin and padding so you have better control with your layout from the start

How can I set fixed position Background image in jquery mobile for iPhone app using Phonegap

I am doing a iPhone app using Phonegap & also using jquery mobile. I want to set background image for data-role=page div. In this height of page is equal to screen & hence background is set to size of screen. But the page content length is much greater than screen & hence gray background is seen after image completes.
My question is whether there is a way so that we can keep the background image fixed & scroll or move only content of page & not background image.
Just to mention I have tried full size background jquery pluggin. Its working on Android but not on iOS.
Can anyone please help? Thanks in advance.
Ok, so what I did instead was to create a fixed element within the body element of the page.
So it would look like
<body>
<div id="background"></div>
...
</body>
And for the CSS I stated the following:
#background {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background: url(images/bg-retina.jpg) 0 0 no-repeat fixed !important;
background-size:contain;
}
And this did the trick for me. Hopefully it helps (someone out there :P)
You looking for css background-attachment property.
div[data-role="page"]{
background-attachment: fixed;
}
Update:
background-attachment:fixed is supported from iOS 5, if you using older version of iOS you may consider usage of iScroll.
you can try this:
.ui-mobile
.ui-page-active{
display:block;
overflow:visible;
overflow-x:hidden;
}
works fine for me.
You can set your background image to the jQuery page:
.ui-page { background-image:url(../ios/sample~ipad.png);
background-repeat:no-repeat; background-position:center center;
background-attachment:scroll; background-size:100% 100%; }
Try with this, this work for me.
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background: url(../Images/loginBackground.jpg) 0 0 fixed !important;
background-size:100% 100%;
background-repeat: no-repeat;
<body>
<div id="background"></div>
...
</body>
css:
#background {
background-image: url("/images/background.png");
background-repeat: no-repeat;
background-attachment: fixed;
height: 100%;
width: 100%;
position: fixed;
background-position: 0 0;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#media screen and (max-width: 480px) {
#background {
background-attachment: initial !important;
}
}
The problem is that iOS mobile devices have errors rendering simultaneously background-size:cover; and background-attachment:fixed; so you have to fix it by #media

Apply margin to running CSS position

I'm using the following CSS code to position my footer at the bottom of the page:
<style type="text/css">
#page {
#bottom-center { content: element(footer); }
}
#footer {position: running(footer);}
</style>
Is there a way to display it slightly higher? Adding margin-bottom: 50px doesn't seem to have an effect.
update: the page will be converted to PDF using iText
I finally managed to get it working with the following CSS:
<style type="text/css">
#page {
margin-bottom: 100px;
#bottom-center {
content:element(footer);
}
}
#footer {
position: running(footer);
}
</style>
Previously, I only tried to add margin-bottom to the #bottom-center and #footer.
To achieve that, you usually use:
#footer {
position: absolute;
bottom: 50px;
}
jsFiddle example