Skip to main content

CSS ideas to spark your Web page

 

Introduction

Cascading Style Sheets referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable. CSS is not a programming language. It's not a markup language either. CSS is a style sheet language. CSS is what you use to style HTML elements selectively. Learning new CSS tricks is one of the best ways to shake up your website design.

Here are a few of the helpful CSS tricks that will definitely help.

1.Selection in CSS

On the web, we select content for different reasons. Maybe we want to copy a text and quote it somewhere, or maybe copying is just a habit that some users do it make reading easier. Usually, when the user selects any text on the web page, it has a white color with a blue background as blue. Why keep your webpage simple and the same as others. Here is an amazing trick.


p::selection{

          background-color: pink;

          color: rgb(235, 23,41);

}

The above code has a function of displaying red text with background color pink when selected.

2.Why use more space?

The CSS overflow-x property defines what to do when content overflows the content box horizontally (i.e., left and right), such as displaying the content outside of the content box, clipping the content, or displaying a horizontal scroll bar.

 div { overflow-x: hidden; }

In that above line of code, the content is clipped, the overflow content is hidden, and no horizontal scroll bar is displayed. This will display the webpage with no scroll bar horizontally, and hence no space will be wasted.

Note: Various other parameters are also available with overflow-x.

3.Negation pseudo-class

For selecting an element that doesn’t have a certain class and in the case of multiple classes, the ":not()" selector is used.

body:not(p){
               color:purple;
}


The above code will not apply the color purple for the tag <p>.


4.Blend Mode

With background-blend mode, we define the blending between the element’s background image and its background color.

body {
           background-image : url(p1.jpg);
           background-color: purple;
           background-blend-mode :screen;
}


 

5.Scroll behavior control

The scroll-behavior property specifies whether to smoothly animate the scroll position, instead of a straight jump, when the user clicks on a link within a scrollable box.


*{
             padding: 0;
             margin: 0;
             scroll-behaviour:
This can be useful when you want to move from down to top just by the click of a button

Comments

Popular posts from this blog

Connect and Configure MongoDB in Django Project

  Django, a high-level Python web framework, is well-known for its robustness and versatility. While Django natively supports popular databases like PostgreSQL and MySQL, you may want to integrate a NoSQL database like MongoDB for specific use cases. MongoDB’s flexibility and scalability make it an excellent choice for handling unstructured data. In this blog, we will walk you through the process of connecting MongoDB to a Django project, enabling you to harness the power of NoSQL in your web applications. Prerequisites: Before we begin, ensure you have the following prerequisites in place: Django installed on your system. MongoDB database server installed and running. Basic familiarity with Django project structure and database concepts. Virtual Environment, this is optional but recommended. You check our blog  here . Note:  For this tutorial, we are using our basic  skeleton project  for Django. You can also download the project from  here . Step 1: Insta...

Mongodb-CheatSheet

  All MongoDb commands you will ever need (MongoDb Cheatsheet) In this post, we will see a comprehensive list of all the    MongoDB  commands you will ever need as a MongoDB beginner. This list covers almost all the most used commands in MongoDB. I will assume that you are working inside a collection named 'comments' on a MongoDB    database  of your choice 1. Database Commands View all databases show dbs Copy Create a new or switch databases  use dbName Copy View current Database db Copy Delete Database  db . dropDatabase ( ) Copy 2. Collection Commands Show Collections show collections Copy Create a collection named 'comments' db . createCollection ( 'comments' ) Copy Drop a collection named 'comments' db . comments . drop ( ) Copy 3. Row(Document) Commands Show all Rows in a Collection  db . comments . find ( ) Copy Show all Rows in a Collection (Prettified) db . comments . find ( ) . pretty ( ) Copy Find the first row matching the ob...

How to host Django Application in AWS using gunicorn & nginx in Production

in this post, we will see how to use    nginx  with    gunicorn  to serve    django     applications  in production.  Django is a very powerful web framework and ships with a server which is able to facilitate development. This development server is not scalable and is not suited for production. Hence we need to configure gunicorn to get better scalability and nginx can be used as a reverse proxy and as a web server to serve static files. Let's get started  Step 1 - Installing python and nginx Let's update the server's package index using the command below: sudo apt update Copy sudo apt install python3-pip python3-dev nginx Copy This will install python, pip and nginx server Step 2 - Creating a python virtual environment  sudo pip3 install virtualenv Copy This will install a virtual environment package in python. Let's create a project directory to host our Django application and create a virtual environment inside th...