Div is truncating words and border on wrapping - css

Maybe this is simple, but is making me nuts.
To understand the problem, the easy way is to look at the image.
Div width is truncating either word or the rounded border(also in case there is a space or dash between words). How can I force each "a" element to go into a new line if width is not enough to contain the element?
Here's the code
<div id="post-tags">
<span class="tag-title">Tagged:</span>
tag2
tag3
tag4
longtag5
<a href="#"li>longtag6</a>
longtag7
longtag8
longtag9
longtag10
longtag11
longtag12
</div>
And the CSS
#post-tags{
width: 560px;
float: left;
padding: 15px;
font-size: 11px;
}
#post-tags .tag-title{
color: #6b6b6b;
padding: 5px 0 0 5px;
}
#post-tags a{
line-height: 24px;
padding: 3px;
background: #a7d1e3;
padding: 4px 10px 4px 10px;
margin: 0 0 10px 0;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#post-tags a:hover{
color: #a7d1e3;
background: #205F82;
}

I found that it doesn't work corerctly in chrome. A solution could be to float the elements. so you add float:left; for the selectors #post-tags .tag-title and #post-tags a. Of course now you will see that there is need to modify and padding and margins. A solution close to yours is applying margin: 0 2px 10px; and padding: 0 10px; for #post-tags a so your new css will seems like the following:
#post-tags {
width: 560px;
padding: 15px;
font-size: 11px;
overflow:hidden;
}
#post-tags .tag-title {
color: #6b6b6b;
padding: 5px 0 0 5px;
float:left;
}
#post-tags a {
line-height: 24px;
padding: 3px;
background: #a7d1e3;
margin: 0 2px 10px;
padding: 0 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
float:left
}
#post-tags a:hover {
color: #a7d1e3;
background: #205F82;
}
here a live example: http://jsbin.com/adika4

Related

Auto Specify Row heights

I've created this CSS code to give me 3 responsive columns, but.. in mobile are sick and Ipad too.
Anyway, my real question is:
1 How to put the 3 rows with auto fit. Because they are all with the same AUTO SIZE.
When none of the boxes contain any content I would like the grid to look small and not BIG.
.pagewrap {
*background: #6B949F;
display: grid;
grid-template-columns:210px 850px 210px;
grid-template-rows: auto auto auto;
grid-gap: 10px;
justify-content: center;
}
.content {
text-align: left;
background: #1C1C1C;
box-shadow:0 6px 6px -6px #000;
border-radius: 3px;
}
.content ul li {
width: 190px;
padding:5px 10px;
background:none;
text-transform: none;
}
.content ul li a {
display: block;
padding:0 15px 0;
color:#BDBDBD;
background:transparent;
font-size: 15px;
transition: all 0.35s ease;
}
.content ul li a:hover {
background:#424242;
border-radius: 1px;
color:#fff;
}
.middle {
margin: 0;
padding: 8px;
text-align: center;
background: #E6E6E6;
box-shadow:0 6px 6px -6px #000;
border-radius: 3px;
}
.sidebar {
padding: 8px;
text-align: center;
background: #1C1C1C;
box-shadow:0 6px 6px -6px #000;
border-radius: 3px;
color:#BDBDBD;
}
I want boxes like this.
https://i.stack.imgur.com/iLhJE.png
try d-flex and justify-content-between.
d-flex will align them into one row and justify-content-between will align them like this: |right center left|

Getting left column to resize with CSS

I am working on a simple redesign for a project I did awhile back, just for practice. I have a left column that remains a certain size no matter what I seem to do. When the content in the main area becomes too great, the left column looks cut off. How do I get this column to extend with the content of the page? Here is the css I have for my containers and the column:
#outerWrapper {
background-color: #fff;
margin: 0 auto 0 auto;
min-width: 760px;
text-align: left;
width: 80%;
}
#outerWrapper #header {
background-color: #8ab573;
border-bottom: solid 1px #628152;
font-size: 18px;
font-weight: bold;
line-height: 15px;
padding: 10px 10px 10px 10px;
}
#outerWrapper #contentWrapper #leftColumn1 {
background-color: #eef6ed;
border-right: solid 1px #8ab573;
float: left;
padding: 10px 10px 10px 10px;
width: 24%;
height: auto;
}
#outerWrapper #contentWrapper #content {
margin: 0 0 0 26%;
padding: 10px 10px 10px 10px;
}
#outerWrapper #contentWrapper .clearFloat {
clear: left;
display: block;
}
#outerWrapper #footer {
background-color: #eef6ed;
border-top: solid 1px #8ab573;
padding: 10px 10px 10px 10px;
Thanks for any suggestions, I know it's really simple I'm just having code block I guess :/

firefox adds strange space arround Pseudo-elements

Take a look at these photos
JSFiddle link at the bottom
firefox:
chrome:
they are both the same element taken from chrome and firefox and as you can see the one from firefox has some space around it's top and left side but the one from chrome doesn't
now, There is no margin or anything that's causing this and it works fine in any other browser except for firefox.
the important styles for the main element is
float: left;
height: 30px;
line-height: 30px;
margin: 12.5px 0;
and for the Pseudo-element ::before
float: left;
display: block;
content: '\F011';
height: 30px;
line-height: 30px;
margin: 0 10px 0 0;
padding: 0 10px;
and the HTML for the element
<button class="like" onclick="item_like()">500</button>
this is the link of JSFiddle
run it in chrome and firefox and see the difference
http://jsfiddle.net/79cEb/5/
what am I doing wrong here?
Maybe try positioning the like absolutely using CSS
.like{
float: left;
height: 30px;
margin: 12.5px 0;
background-color: #FAFAFA;
border-radius: 4px;
position:relative;
padding: 0 10px 0 40px;
margin: 12.5px 10px;
background-color: #000;
font: 16px/30px arial;
color: #FFF;
border:none;}
.like::before{
position:absolute; top:0; left:0;
width:30px;
content: 'like';
margin: 0 10px 0 0;
padding: 0 5px;
background-color: #FF7373;
color: #FFF;
border-right: 1px solid #CCC; display:block; border:0;
}
I'd recommend you to specify top:0; left: 0; to your ::before pseudo elements. Sometimes cheeky browsers take a few px up and left to the actual position. CSS:
.like:before {
float: none;
width: 30px;
content: "like";
margin: 0px 10px 0px 0px;
padding: 0px 5px;
background-color: #FF7373;
color: #FFF;
border-right: 1px solid #CCC;
position: absolute;
top: 0;
left: 0;
border-radius: 4px 0 0 4px;
}
.like {
float: none;
height: 30px;
border-radius: 4px;
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.5);
padding: 0px 10px 0px 0px;
margin: 12.5px 10px;
background-color: #000;
font: 16px/30px arial;
color: #FFF;
border: medium none;
position: relative;
width: 88px;
text-align: right;
}
Fiddle: http://jsfiddle.net/79cEb/13/
I made you this solution, it places the button relative and the :before class absolute. Then you can use the top, bottom and left position, which will be relative to parent.
Note that I added a overflow: hidden to the button, so the rounded borders are still visible.
This is the altered CSS:
.like {
float: left;
height: 30px;
margin: 12.5px 0;
background-color: #FAFAFA;
border-radius: 4px;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
padding: 0 10px 0 40px;
overflow:hidden;
margin: 12.5px 10px;
background-color: #000;
font: 16px/30px arial;
color: #FFF;
border:none;
position: relative;
}
.like::before {
float: left;
width:30px;
position: absolute;
left: 0;
top: 0;
bottom: 0;
content:'\F011';
background-color: #FF7373;
color: #FFF;
border-right: 1px solid #CCC;
}
Also, see the updated Fiddle.

Span not fitting round input

The span will just not expand to the height of the text input, I just want them to be the same height. I don't know why it wont expand
The code - http://jsfiddle.net/8Jxsd/
input{
font-size: 28px;
border: none;
margin: 0;
}
#searchbox{
font-family: 'Source Sans Pro', sans-serif;
outline: none;
font-size: 18px;
margin: 0 auto;
padding: 5px 0 5px;
-webkit-border-radius: 5px;
border: 1px solid #000;
background-color: #FFF
}
#searchinput{
padding: 5px;
-webkit-border-radius: 5px;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 0;
-webkit-box-shadow: none;
}
#searchgo{
padding: 5px;
background-image: url(images/arrow.png);
background-repeat:no-repeat;
width: 40px;
background-position: 0 -1px;
-webkit-border-radius: 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-box-shadow: none;
text-indent: -500em;
}
<span> is an inline element by default. Change inline element to a block element by
display:inline-block;
Inline elements are displayed on the same line of the parent but each block level element will occur on next line with own width and height. we need the span be in same line and block so you can have inline-block property for display so that in same line the span will take own width height.
replace rule font-size: 28px; in selector input {} with rule font-size: inherit;
use display:inline-block; with span class
#searchbox{
display:inline-block;
}
Js Fiddle

box-shadow - Is this possible?

I need to make a shape like the one below and was trying to get it working with CSS.
The closest I could get was like this. I had to push the shadow on the bottom part down or else it would overlap with the shadow on the top.
Is it possible to actually make the top version with CSS?
Working Example Here
CSS
.block-a {
display: block;
height: 200px;
width: 200px;
background-color: #8BC541;
-moz-box-shadow: 0 0 10px #000;
-webkit-box-shadow: 0 0 10px #000;
box-shadow: 0 0 10px #000;
-webkit-border-radius: 10px;
-webkit-border-bottom-right-radius: 0;
-moz-border-radius: 10px;
-moz-border-radius-bottomright: 0;
border-radius: 10px;
border-bottom-right-radius: 0;
}
.block-b {
color: #fff;
text-align: center;
line-height: 40px;
position: relative;
display: block;
height: 40px;
width: 80px;
margin-left: 120px;
-moz-box-shadow: 0 0 10px #000;
-webkit-box-shadow: 0 0 10px#000;
box-shadow: 0 0 10px #000;
-webkit-border-bottom-right-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background-color: #8BC541;
}
.block-b:before {
position: absolute;
background-color: #8BC541;
height: 11px;
width: 90px;
top: -11px;
left: -10px;
display: block;
content: "";
}
.block-b:after {
padding-left: 5px;
color: #fff;
content: "▲";
}
HTML
<div class="block-a"></div>
<div class="block-b">Login</div>
Image
It's an answer pile-on! Looks like you have lots of options to work with. I'll add another to the pile: http://jsfiddle.net/XrkJq/

Resources