How to add Border around widget in Blogger - css

I'm looking for is the trick to create that border around the widget as shown in the image:
And the title should stick to the top.
Any idea how to do that kinda trick?
Thanks in advance :)

You can use like this -
body{
background: #ccc;
}
.border-col{
min-height: 300px;width: 220px;
background: #ccc;border:2px solid #fff;
margin: 10px auto 0;
position: relative;
}
.border-col h2{
background: #ccc;
font-size: 15px;
left: 0;
margin: auto;
padding: 3px;
position: absolute;
right: 0;
top: -13px;
width: 60px;
}
<div class="border-col">
<h2>Heading</h2>
</div>

Related

Fixed position issue with 100% width

I am having the following error when using
.high-secuity {
position: fixed;
top: 0;
background: #ff782f;
color: #fff;
width: 100%;
border-radius: 0;
margin-bottom: 0;
margin-left: -15px;
}
the issue is that the orange panels goes outside the screen. How can I fix this?Don't want to use fixed widths as it should be responsive
with width: inherit; to the orange block my example is working
body {
background-color: #ccc;
}
.container {
position: relative;
width: 300px;
background-color: #fff;
overflow: hidden;
padding: 50px 15px;
}
.high-secuity {
position: fixed;
top: 0;
background: #ff782f;
color: #fff;
width: inherit;
border-radius: 0;
margin-bottom: 0;
margin-left: -15px;
padding: 15px;
}
<div class="container">
<h1>Osloskolen</h1>
<div class="high-secuity">Your message</div>
</div>

Heading border expand outside of viewport

I'm trying to achieve headings with border that expands outside of viewport on one side, just like on the picture below.
I've managed to code the one that is aligned to the left and border expands to the left side using code like this:
.wrapper {
width: 1100px;
margin: 0 auto;
box-sizing: border-box;
padding: 1.5rem;
}
h2 {
font-size: 2em; /* 32/16 */
font-weight: 200;
color: #000;
position: relative;
margin: 0 -9600rem;
padding: 1.2rem 9600rem;
background: transparent;
z-index: 0;
display:block;
max-width:660px;
}
h2::before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0rem;
right: 9598.5rem;
background: transparent;
border:2px solid #000;
}
h2.right {
font-size: 2em; /* 32/16 */
font-weight: 200;
color: #000;
text-align: right;
position: relative;
margin: 0 -9600rem;
padding: 1.2rem 9600rem;
background: transparent;
z-index: 0;
display:block;
max-width:660px;
}
h2.right::before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 9598.5rem;
right: 0rem;
background: transparent;
border:2px solid #000;
}
<section>
<div class="wrapper">
<h2>s každou nehnuteľnosťou možno pohnúť najmä vo váš prospech</h2>
<h2 class="right">s každou nehnuteľnosťou možno pohnúť najmä vo váš prospech</h2>
</div>
</section>
HTML:
CSS:
Problem is with the text that is supposed to be aligned to the right of the wrapper and expand the border to the right. My results so far look like this:
The text still begins on the left edge of the wrapper and is not 660px from the right edge of the wrapper as it is supposed to be. Any idea how to fix this? I've tried playing around with multiple variables but nothing worked.
I have played around a little with it in a fiddle: https://jsfiddle.net/38t1286m/
EDIT: I played with it some more... https://jsfiddle.net/38t1286m/4/ ;)
Basically I have simplified it, so that the HTML looks like this:
<header>
<h2>
This is my LEFT side header
</h2>
</header>
<p>
Here is some text in between...
</p>
<header class="right">
<h2>
This is my RIGHT side header
</h2>
</header>
And with the following css:
p {
width: 660px;
margin-right: auto;
margin-left: auto;
}
h2 {
border: 1px solid black;
max-width: 660px;
margin: 0;
margin-left: auto;
display: inline-block;
padding-top: 20px;
padding-bottom: 20px;
}
header {
position: relative;
max-width: 660px;
padding: 0;
margin: 0;
margin-right: auto;
margin-left: auto;
}
header:before {
content: " ";
width: 660px;
border: 1px solid red;
position: absolute;
left: -660px;
right: -660px;
overflow: hidden;
top: 0;
bottom: 0;
}
header.right {
text-align: right;
}
header.right:before {
left: 660px;
right: 660px;
}
That's at least how I think I would solve it. :)
You could float the second heading to the right, and then clear it using :after
h2.right {
text-align: right;
background: transparent;
z-index: 0;
float: right;
}
h2.right::after {
content: '';
clear: both;
}
codepen

Topbar off center?

I have a div that I'm using as a topbar with the code below:
#topbar {
height: 40px;
width: 100%;
background-color: #336680;
box-shadow: 0.1em 0.1em 0.1em;
position: absolute;
top: 0;
padding: 0;
}
I'm trying to make it go across the whole screen but for some reason it's off center and doesnt cover the left portion of the screen. How do I fix this?
Just add left:0. So...
#topbar {
height: 40px;
width: 100%;
background-color: #336680;
box-shadow: 0.1em 0.1em 0.1em;
position: absolute;
top: 0;
padding: 0;
left:0;
}

How can I create a comic-strip style speech bubble?

How can I style a div to look like a comic-strip speech bubble in CSS?
Here's an image demonstrating what I mean:
Is there a way of doing this in pure CSS?
A quick example, you can tweak it to fit your needs .. and since I cannot post a fiddle without code:
HTML:
<div class="balloon">
O hai !
<span class="tip"></span>
</div>
CSS:
body { background: #000; }
.balloon {
width: 250px;
height: 75px;
padding: 50px;
background: #fff;
border-radius: 50px;
position: relative;
font-size: 34px;
text-align: center;
}
.balloon .tip {
width: 0;
height: 0;
position: absolute;
right: 70px;
bottom: -20px;
border: solid 10px;
border-color: #fff transparent transparent transparent;
}
http://jsfiddle.net/6rzDK/

how to give a DIV with position:absolute; the width of its content?

I am trying to let the width of a div to be expanded according to its content horizontally
the content is a floating divs , I want them to appear as one row
I used white-space: nowrap; but it is not working on IE and FF ( It works very fine on google chrome )
here is my HTML code :
<div class="floating_menu_container">
<div class="floating_menu">
<div class="floating_menu_item account">
<div class="sub_floating_menu">
<div class="sub_floating_menu_item"></div>
<div class="sub_floating_menu_item"></div>
</div>
</div>
</div>
</div>
and this is the CSS code :
.floating_menu_container{
position: absolute;
top: 25px;
left: 5px;
height: 50px;
z-index: 5;
}
.floating_menu_container .floating_menu{
height: 0px;
width: 40px;
background: #4D75A6;
z-index: -1;
position: absolute;
top: 35px;
left: 7px;
}
.floating_menu_container .floating_menu .floating_menu_item{
width: 30px;
height: 30px;
background: #94acc9;
border: 1px solid #6991c2;
margin: 7px 0px 4px 4px;
cursor: pointer;
position: relative;
}
.floating_menu_container .floating_menu .floating_menu_item .sub_floating_menu{
height: 30px;
position: absolute;
top: 0px;
background: #4D75A6;
left: 42px;
border: 1px solid #003980;
z-index: 10;
cursor: default;
white-space: nowrap;
}
.floating_menu_container .floating_menu .floating_menu_item .sub_floating_menu .sub_floating_menu_item{
width: 20px;
height: 20px;
background: #94acc9;
margin: 5px;
float: left;
cursor: pointer;
}
and here is the example on jsfiddle
I want to expand the div with class='sub_floating_menu' according to its content
Removing width: 20px; from your .sub_floating_menu_item, height: 30px; from .sub_floating_menu, and replacing float: left; with display: inline-block; should fix the issue, little demo: little link.

Resources