Background color and background image below element - css

The idea was to make the not valid error tip that comes up when people fail to fill out a required field show up like a speech bubble. So the arrowhead image shows in the center and underneath the text and would point into the field that they missed.
Fiddle here
HTML:
<span class="wpcf7-not-valid-tip">Please fill the required field.</span>
CSS:
.wpcf7-not-valid-tip {
background: red;
color: white;
padding: 10px;
width: 100px;
background-position: 0 0;
background-repeat: no-repeat;
background-image: url('http://s24.postimg.org/qacevkf7l/green_error_arrow.png');
}
As you can see I have a background color and the arrow image that needs to sit in the middle of the element and below it but, of course, if you position it using background-position, the image is hidden as it cannot overflow outside of the element itself. This would be easy if I could easily edit the HTML but I would prefer not to as I am using a plugin and want to be free to update the plugin in the future.
QUESTION:
Is there a pure CSS solution?
If not (and I suspect there isnt) what is the cleanest way to solve this issue? Would I use add_filter to alter the html to put a div around the tooltip that i could then add the bg image to? Something with css "content:", a js solution?

Got the answer elsewhere.Will accept unless someone can think of something better.
http://jsfiddle.net/D2KFX/2/
This works perfectly using CSS (albeit adding content with the content: declaration) by drawing a triangle with borders instead of using an image for it.
CSS
.wpcf7-not-valid-tip {
background: red;
color: white;
padding: 10px;
width: 100px;
}
/* Updated code */
.wpcf7-not-valid-tip {
position: relative;
}
.wpcf7-not-valid-tip:after {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(255, 0, 0, 0);
border-top-color: red;
border-width: 10px;
left: 50%;
margin-left: -10px;
}

Related

Scooped Corners with border but only on one side

So I am trying to create scooped corner (on bottom-right only) with border around the complete structure. Please refer image below.
Check image here
I have seen many examples on how to create scooped corners on all the 4 sides and creating scooped corner on one side only. But not able to find anything this specific use case.
I am a beginner in CSS. So my question could be pretty noob also.
Thanks in advance.
As this scoop is just for visual effect rather than having any semantics attached, one way of doing this using simple CSS is to use a pseudo element to create it, have that sitting over the actual element and with a background color so it overwrites the borders at the bottom.
To make this general you can introduce CSS variables to set size and positioning in proportion but just to get you started here is an example using vmin as the unit of size:
body {
background-color: black;
}
div {
width: 90vmin;
height: 90vmin;
position: relative;
border: solid 3px lime;
border-radius: 10vmin;
background-color: gray;
}
div::after {
content: '';
position: absolute;
width: 40%;
height: 40%;
border-color: transparent transparent transparent lime;
border-width: 3px;
border-style: solid;
top: 80%;
left: 80%;
border-radius: 50%;
transform: rotate(45deg);
background-color: black;
}
<div></div>

Travelify CSS - Add image directly below nav bar and border / image questions?

I am using the travelify theme to build my website and for the most part I am really happy.
How would I add the lace image below the navigation bar as seen in the image? I can do it in firebug but have no idea how this would work with travelify and css.
http://test.modellicreations.com/wp-content/uploads/2015/02/laceundernav.jpg
Also, how would I replace the footer dashed border line with an image?
Lastly, how do I put a border/outline around the entire table? Every code I have tried puts a border around every cell which I do not want.
You can see the site here:
1: http://test.modellicreations.com
Thank you in advance!
You can add the image with css, add this class in your css file style.css :
nav#main-nav:after {
content: '';
background: url('http://test.modellicreations.com/wp-content/uploads/2015/02/lacebarflip.jpg') no-repeat;
display: block;
width: 100%;
height: 22px;
visibility: visible;
}
#main-nav {
background: #006666;
border-color: #006666;
border: none;
}
Yes you can replace footer dashed border to an image with this style :
#site-generator:before {
background: url('http://test.modellicreations.com/wp-content/uploads/2015/02/lacetop.jpg') no-repeat;
content: '';
height: 20px;
display: block;
position: relative;
bottom: 20px;
}

How to get an offset border round the visible part of the browser window

I've got a set up similar to this: http://codepen.io/anon/pen/iAJnx where the main content is rather long. What I want to do is to put a border round the visible part of the screen as in this screenshot: http://i.imgur.com/ENtLau4.png
What I want to do is to create 4 divs that are positioned at the edges of the screen, but I'm struggling both with the positioning and giving the divs height and width without content. Does anyone have an idea about this?
Note: I've already tried using an overlay, but it makes the content non-clickable.
Try this:
HTML:
<div class="border-box"></div>
CSS:
body { position: relative; }
.border-box {
border: 5px solid blue;
box-shadow: 0 0 100px 100px #fff;
position: fixed;
pointer-events: none;
bottom: 10px;
left: 10px;
right: 10px;
top: 10px;
}
How it works:
I absolutely positioned an overlay with borders, that will stick the edges of the screen by using top, bottom, left, right definitions. To make the content below selectable, you set pointer-events: none; on the overlay.
Example: http://codepen.io/anon/pen/BxJbh
If you want to achieve the same results without adding additional HTML markup, you can use the :before sudo selector to prepend a block to the body. Simply add this CSS and it will produce the same results:
body:before {
border: 5px solid blue;
box-shadow: 0 0 100px 100px #fff;
display: block;
content: '';
position: fixed;
pointer-events: none;
bottom: 10px;
left: 10px;
right: 10px;
top: 10px;
}
Example: http://codepen.io/anon/pen/BDhql
you have to set in your content id (#content)
border:4px solid blue;
min-width:700px; //change accordingly.
min-height:1600px //change accordingly
The above code will fix the problem of border as well as the height & width you want to set without having any content.

Mobile CSS Overlay Not Appearing Correctly

Thanks in advance for any advice you can offer! I've got an overlay that works well on a desktop version of my website. However, when I design the overlay for use on a mobile, it gives me problems. Here's the jfiddle:
http://jsfiddle.net/kevindp78/bs3FT/1/
Code is below. When I try this in a mobile view, the content seems to be appearing at the wrong level (maybe below the #fixedoverlay but above the #overlaymatte?) Basically, I can't interact with the content in the #overlaycontent for some reason. It's got a layer of dark background over it, and there's only a strip of white at the top of the div. Any ideas? Thanks!
My CSS:
#fixedoverlay, #overlaymatte {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000000;
opacity: 0.7;
filter: alpha(opacity=70);
z-index: 999;
}
#overlaycontent {
position: relative;
width: 960px;
margin: 25px auto;
max-height: 75%;
overflow: auto;
background: #fff;
padding: 20px;
/* border: 20px solid #fff; */
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
z-index: 9999;
}
#overlaymatte {
background: none;
}
My HTML
<div id="fixedoverlay">
<div id="overlaymatte"></div>
<div id="overlaycontent">
<div><p>Here's my content</p><p>Here's my content</p><p>Here's my content</p><p>Here's my content</p><p>Here's my content</p></div>
</div>
</div>
Apologies, but this is the result of an HTML and javascript issue related to the mobile design software I am using (Mobify.) Essentially, I have a bit of javascript that automatically appends the overlay:
function popUpOverlay(){
$('body').append('<div id="fixedoverlay"><div id="overlaymatte"></div><a title="close" href="#" class="closeoverlay">Close</a><div id="overlaycontent"></div></div>');
$('#overlaycontent').append(loaderimg);
$('#loaderimg').show();
$(window).keydown(function(e){
if(e.keyCode == 27) {
$('#fixedoverlay').remove();
}
})
}
My problem was that I was applying Javascript twice throughout the website: once in the head of the document through a reference link, and once through Mobify's Global Selections / Script feature. Since javascript was being applied twice, I was actually seeing two instances of the overlay: one on top of the other. I fixed the javascript so that only one instance occurred, and the problem no longer happens.

Not being able to click a link next to a fixed div.

EDIT: Problem is solved.. I can't believe I didn't think about that to begin with.
Solution:
#message-box{position:fixed;bottom: 29px;left:0px;width: 400px;}
---- Original message :
Hi,
Here is the image:
http://i242.photobucket.com/albums/ff198/Warz/divchatproblemmodified.png
(it says id=footer there but its supposed to say id=footerbar. Also the bar in the very bottom (where you enter a message, with an id called "statusbar" ) should cover width: 100%; as it already does. )
I'm trying to create a bottom bar on my site with chat. The chat size should be possible to resize (change height). As you can see, I placed a div (msg-top) above the chat, which means, when chat is resized the msg-top should also be moved.
If you take a look at the following image you will see the problem. The <div id="footerbar"> has following settings and hence cover the entire area:
#footerbar {position: fixed;bottom: 0px;left: 0px;right: 0px;}
All the divs are children of #footerbar.
Because of this, if I resize the chat box to height 100% no links can be clicked. Even with small height like on the picture, all links to the right of chat box cannot be clicked...
What can I do to solve this?
Thanks!
The other divs:
/* background opacity */
#opacity-me,#msg-top,#msg-messages,#statusbar {
background: black;
color: white;
border-top: dotted 1px white;
opacity: .90;
filter: alpha(opacity="90");
z-index: 200;
overflow: hidden;
overflow-y: auto;
}
#statusbar {
position: relative;
}
#message-box{
position:relative;
width: 400px;
}
#msg-top {
overflow: hidden;
border: 0px;
border: dotted 1px white;
}
#msg-messages {
padding-left: 4px;
padding-right: 4px;
height: 100px;
border: 0px;
}
The Element is below another Element, so you're not able to klick the Link, the Link is still working... just use z-index on footerbar or try to change the footerbar position...
give the div id=footer a height, so something like:
#footerbar {position: fixed;bottom: 0px;left: 0px;right: 0px; height:30px;}
this should fix it, just adjust the height accordingly. let me know if this works.

Resources