Add Pipe symbol after each li of ul in css

li + li:before{
content: ” | ” !important;
padding: 0 5px !important;
}

Advertisements

Auto hide placeholder text using css

We shall see how to auto hide the placeholder text when it is focused.

Add this css code at the top of your style sheet.


textarea:focus::-webkit-input-placeholder
{
color: transparent;
}
textarea:focus::-moz-placeholder{
color: transparent;
}
textarea:focus:-moz-placeholder{
color: transparent;
}
input:focus::-webkit-input-placeholder
{
color: transparent;
}
input:focus::-moz-placeholder{
color: transparent;
}
input:focus:-moz-placeholder{
color: transparent;
}

The above css code will auto hide the placeholder text inside input fields and textarea fields.

RWD(Responsive Web Design) code for all mobile devices

By using the following code in your stylesheet you may make your website site responsive in various screen resolutions and mobile devices

/* Smartphones (portrait) */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* Smartphones (landscape) */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait and landscape) */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Your Code */
}

/* iPads (portrait and landscape) */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
/* iphone */
@media only screen and (min-device-width: 480px){}
/* iPhone 5 */
@media (device-height: 568px) and (-webkit-min-device-pixel-ratio: 2)
{
/* Styles */
}
/* tablets */
@media only screen and (min-device-width: 768px){}

switch off responsive design with one click

How to integrate?

  1. Download and reference responsive-switch.min.js in the <head> of your responsive website’s HTML code.
  2. Add the following link to your website:
    <a href="#" class="rs-link" data-link-desktop="Switch to desktop version" data-link-responsive="Switch to responsive / mobile version"></a>
  3. Done.

Code example

<html>
<head>
...
http://scripts/responsive-switch.min.js
...
</head>
<body>
...
<a href="#"
class="rs-link"
data-link-desktop="Switch to desktop version"
data-link-responsive="Switch to responsive / mobile version"
data-always-visible="false"></a>
...
</body>
</html>
You can control the link behaviour with the following attributes:

data-link-desktop Text for linking to desktop version. There is no default text. You can also leave it blank and style the link with the according CSS classes.
data-link-responsive Text for linking to responsive version. There is no default text. You can also leave it blank and style the link with the according CSS classes.
data-always-visible Whether link should be displayed all the time (“true”) or only if browser window or screen size SMALLER than 1024px (“false”). Defaults to “false”. We recommend to use “false” for production websites and “true” only for development purpose.

CSS classes

Depending on the “Responsive on/off” state, the “Responsive Switch” link has some CSS classes for styling.

rs-link-to-desktop Website is in “Responsive Design” mode (default)
rs-link-to-responsive Website is in “Desktop” mode
rs-link-active “Responsive Switch” link IS visible (browser window or screen size SMALLER than 1024px)
rs-link-inactive “Responsive Switch” link NOT visible (browser window or screen size LARGER than 1024px)

API

Using the default method of adding a link with the “Responsive Switch” CSS class is simple. But you can also trigger the “Responsive Switch” via custom JavaScript code. Just call responsiveSwitch.toggle() like in the following example. It will toggle between the desktop and the responsive view and also update all “Responsive Switch” links on your website.


responsiveSwitch.toggle();

Different ways to integrate a CSS into a Web page

There are three ways to integrate CSS into a Web page

a.) Inline: HTML elements may have CSS applied to them via the STYLE attribute.

Explanation:

  • Internal Styles Cannot be reused at all,period. Inline styles are placed directly inside an HTML element in the code.

Example:

<p style=”padding-left: 150px;”>LORUM IPSUM </p>

b.) Internal / Embedded: By placing the code in a STYLE element within the HEAD element.

Explanation:

  • These styles can be used only for webpage in which they are embedded.
  • Therfore, you would need to create these styles over and over again for each webpage you wish to style.

Example:

<head>
<style>
body
{
    background-color: linen;
}

h1 {
    color: maroon;
    margin-left: 40px;
}
</style>
</head>


c.)External: Place the CSS in an external file and link it via a link element.

Explanation:

  • An External Style sheet is a separate file which is then linked to the web page.
  • The External Style Sheet is basically a text file that is saved as a .css file.
  • we place the link in the <head> section of the page.

Example:

<head>
<title>
<link href=”main.css” rel=”stylesheet” type=”text/css”>
</title>
</head>