Skip to main content

CSS Tricks and Techniques 2018

As time goes by, CSS is becoming more and more powerful and nowadays it allows a lot of possibilities. This article is a compilation of fresh, advanced tips and techniques to master your CSS skills.

Website Development Company Lucknow
Software and Website Development Company Lucknow

Using SVG for icons
SVG is supported by all modern browsers and scales well for all resolution types, so there’s no reason to continue using .jpg or .gif images for icons. Note the use of the background-size property to scale the background image on the on container size.
.logo {
  display: block;
  text-indent: -9999px;
  width: 100px;
  height: 82px;
  background: url(kiwi.svg);
  background-size: 100px 82px;
}
Fixed table layouts
A widely supported but surprisingly little-known property which changes the way the tables are rendered and gives you a sturdier, more predictable layout.
table {
  table-layout: fixed;
}
Curve text around a floated image
The shape-outside is a CSS property that allows geometric shapes to be set, in order to define an area for text to flow around.
.shape {
  width: 300px;
  float: left;
  shape-outside: circle(50%);
}
Intrinsic Ratio Boxes
Using 20% for padding makes the height of the box equal to 20% of its width. No matter the width of the viewport, the child div will keep its aspect ratio (100% / 20% = 5:1).
.container {
  height: 0;
  padding-bottom: 20%;
  position: relative;
}

.container div {
  border: 2px dashed #ddd;  
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}
Color fade on hover
A very easy way to make your links (or any other element) look better.
a {
 color: #000;
 -webkit-transition: color 1s ease-in; /*safari and chrome */
 -moz-transition: color 1s ease-in; /* firefox */
 -o-transition: color 1s ease-in; /* opera */
}

a:hover { 
 color: #c00;
}
Style broken images
Broken images never look good, but it happens every now and then that one or two images on your site are broken. Using some advanced CSS, it is possible to style broken images and provide custom error messages to your visitors.
img {  
  min-height: 50px;
}

img:before {  
  content: " ";
  display: block;

  position: absolute;
  top: -10px;
  left: 0;
  height: calc(100% + 10px);
  width: 100%;
  background-color: rgb(230, 230, 230);
  border: 2px dotted rgb(200, 200, 200);
  border-radius: 5px;
}

img:after {  
  content: "\f127" " Broken Image of " attr(alt);
  display: block;
  font-size: 16px;
  font-style: normal;
  font-family: FontAwesome;
  color: rgb(100, 100, 100);

  position: absolute;
  top: 5px;
  left: 0;
  width: 100%;
  text-align: center;
}
Empty and not empty attribute selectors
CSS3 makes it easy to apply different styles to an element, depending on whether a data-* attribute is empty or not. Have a look at the HTML code below:
<div data-attr="">
</div>

<div data-attr="value">
</div>
And now, our CSS, with specific styling for any div element with an empty data-attr attribute:
div {
  border: 1px solid gray;
  height: 100px;
  margin: 10px;
  width: 100px;
}

/* Empty attribute selector */
div[data-attr=''] {
  background: red;
}

/* Not empty attribute selector */
div:not([data-attr='']) {
  background: green;
}
Comma-Separated Lists
A little snippet to display an unordered list as a comma-separated list. Note the use of :not(:last-child) to ensure that the last list element won’t be followed by a comma.
ul > li:not(:last-child)::after {
  content: ",";
}

Source: catswhocode

Comments

Popular posts from this blog

List of Youtube Channels That Can Boost Your Development Career In 2018 | BSN Infotech Pvt. Ltd.

Youtube is the largest collection of videos in the world. Here you can get a lot of knowledge about any topic you want. As we know Software engineers, Web Developers, Designers all of them are fully dependent on an Internet. When they search on the internet for any code or to know the working of any software tool, they always prefer videos for it. Videos are the best method of understanding any topic or any new tool or technology. It's very much similar like we are getting knowledge about anything in our classroom.

Here is a List Of Youtube channels that can help you to Boost your knowledge and career.




1. The New Boston

The New Boston has a huge array of high-quality video tutorials (over 4200) on computer programming, game development, web design, and lots of other computers related topics. Initially, it was a YouTube channel but later it grew into an online community. The man behind this awesome YouTube channel is Bucky Roberts.

Tutorial on: ECMAScript 6, React JS / Redux, Django, A…

Manpower Outsourcing Benefits

The term "Manpower outsourcing" evolved when companies found that they need some employees for their short-term projects. Companies don't want to make them permanent, because if they make those employees permanent then they have to give all regular employee benefits. So they start hiring employees from third party manpower outsourcing companies.
Employees provided by Manpower outsourcing companies are very talented because they have very qualified management team to filter talented persons. As we know whole world is covered with highly skilled and qualified professionals of India. Approx. all the top MNCs, Research centres are occupied by Indian professionals, doctors, engineers, etc. that is why every big company is always ready to higher Indians.

BSN Infotech Pvt. Ltd. is one of the best Manpower outsourcing company in Lucknow. We provide all type of staffing services in MNCs, small organisations, companies and in Government Sector also.


Some of the benefits of manpower o…