7/6/21

CSS Tutorial :- CSS Padding Property

CSS PADDING

CSS Padding Property is used to give some space between the element content and element border. Just like margin you can provide the padding from the top, bottom, left, right, etc. You can independently apply padding on the element using separate properties.  And you can also apply padding property at once by using shorthand property. 

But, Padding and margin property both are different from each other. The difference between margin and padding was the margin property would have applied outside the element. But the padding property would have applied inside the element.

CSS Padding Properties

  1. Padding: - This property is used to set padding in one declaration. 
  2. Padding-top: - This property is used to set padding at the top. 
  3. Padding-right: - It is used to set the padding from the right side of the element. 
  4. Padding-bottom: - It is used to set the padding from the bottom of the element. 
  5. Padding-left: - This property was applied from the left side of the element. 

CSS Padding Values

The Value of padding can be set in Four ways: -

  1. Length: - It Specifies padding in px, pt, cm etc.    
  2. % (percentage): - It define padding in % percentages
  3. Initial: - It set the padding at default values.
  4. Inherit: - It inherits padding from its parent elements

Example: - 

<!DOCTYPE html>
<html>

<head>
    <style>
        .container {
            displayflex;
        }

        #first,
        #second {
            border2px solid red;
            width30%;
            height120px;
            /* padding: 23px 23px 23px 23px; */
            margin23px;
        }
    </style>
</head>

<body>

    <h1> Padding Property </h1>

    <div class="container">
<p id="first"><b> This is First Paragraph.</b><br><br> Lorem ipsum, dolor
 sit amet consectetur adipisicing elit.
Assumenda libero impedit omnis voluptatibus, in neque 
nulla sed quis voluptatum repellat! Hic, cumque vero!</p>
        
<p id="second"> <b> This is Second paragraph.</b><br><br> lsdjlajsdljaldsj
asdjflasjdflajsdlfjasldfjlas dflads flaskdj fl asdjflkasd flasdjflkasd 
jflkasdjfil asdflkasdjf jdlasd flsad flkasdjf lasdfj lasdf alskdjfalsk dfjlaksd
faslkdfj alskdfjlaksd jflasdjflk .</p>
   
 </div>

</body>

</html>

Ouput: -

Without Padding

With Padding


Continue Reading →

7/2/21

Introduction of Loop in C Programming Language.

Has it ever happened to you that in C programming you have to print a code of block several times? And you have to write that code again and again. If you write the same thing several times. Then your code will get long, complex, and difficult to read. 

And didn’t want to write the same code again and again. So what is its solution? The Solution is Loop. Loop that statement until the condition is not satisfied. Let’s talk about the loop. What is a loop? How its work? etc. etc. 

Introduction of Loop

The Loop is used to execute a statement until the condition of the code is not satisfy. In simple words, a loop provides us to execute a group of statements or multiple instructions multiple times. For Example, if you have to print 1-10 numbers then instead of using printf statement 10 times, we can use printf inside the loop which runs up to 10 iterations.

Advantages of Loop

  1. The first and main thing of the loop is we didn’t write the same code again and again.
  2. Reduce the length of the code. 
  3. The Code is readable. And easy to understand.
  4. It provides the code reusability. 
  5. Loop takes less memory space comparing (write the code several times)

There are mainly 3 types of loops available in the C programming language. These are:-

  1. While Loop
  2. For Loop
  3. Do-While Loop

Let’s See a simple example of a loop. 

Write a program to print the First 50 natural numbers using the loop.

A natural number is a positive number (counting) so don’t be confused about it.


#include<stdio.h>

int main()
{
    int i;

    for (i=1; i<=50; i++)
    {
        printf("%d \n", i);
    }
    return 0;
}

Output:- 


Look at the length of the code. Using the loop the length of the code is reduced. If we have to print 50 numbers without using a loop then we have to write printf statement 50 times. And think if I said to you that, you have to print 50 lakh numbers. I bet, you are not going to do it at any cost. Writing printf statement 50 lakh times is not an easy job.

Continue Reading →

7/1/21

CSS Tutorials : CSS Opacity Property

CSS Opacity

The CSS Opacity property is used to specify the transparency of the Html element. In other words, You can also say that it specifies the clarity of the element. 

The Opacity property value takes from 0.0 to 1.0. The lower value, the more transparency. Look at the image below. 
The First Image that you see in the example has 0.2 Opacity. The Second image has 0.5 and the last image has a default value of 1. 

Look at the Code below to understand how its works. 
<!DOCTYPE html>
<html>
<head>
<style>
 
#img1 {
  opacity0.2;
}
#img2{
    opacity0.5;
}
#img3{
    opacity1;
}
</style>
</head>
<body>
 
<h1>Transparent Images</h1>
 
<img id ="img1" src="1.jpg" width="270" height="200">
<img id ="img2" src="2.jpg" width="270" height="200">
<img id ="img3" src="3.jpg" width="270" height="200">
 
</body>
</html>
 

Transparent Boxes 

You can also use the opacity property to transparent the box or text area. Look at the example below.

Example:- 

<!DOCTYPE html>
<html>
<head>
<style>
p
    background-colorchocolate;
    padding10px;
}
#p1 {
  opacity1;
}
#p2{
    opacity0.5;
}
#p3{
    opacity0.2;
}
</style>
</head>
<body>

<h1>Transparent Boxes</h1>

<p id = "p1"> Opacity 1</p>
<p id = "p2"> Opacity 0.5</p>
<p id = "p3"> Opacity 0.2</p>


</body>
</html>

Output :-

Apply Hover Effect Using Opacity

You can also hover over the image in the form of opacity. Let's Try it 

<!DOCTYPE html>
<html>
<head>
<style>
img:hover{
    opacity0.5;
}
</style>
</head>
<body>

<h1> Hover Property </h1>

<img id ="img1" src="1.jpg" width="270" height="200">
<img id ="img2" src="2.jpg" width="270" height="200">
<img id ="img3" src="3.jpg" width="270" height="200">

</body>
</html>

Ouput :-

Before Hover 

After Hover

That's All of today guys hope you all understand this opacity property very well. If you have any doubt comment below we will definitely try to solve it. 
Continue Reading →

6/28/21

C Switch Statement in C Programming Language.

In this tutorial, we are going to learn about Switch Statement in the C programming language. We have already seen if, if-else, nested if-else, condition, etc. If you haven’t read those tutorials then first go and read those tutorials then read them. 

Topics that cover today.

  1. C switch statement
  2. C Switch Syntax
  3. Flow chart of C Switch Statement
  4. Example of C switch statements

So let’s go with our today’s topic. 

C Switch Statement

The C switch statement is used to execute a code block among many alternatives statements. The Switch statement allows the variable to be tested with the statement( Values) also known as Case written in the switch statement and if the statement is verified(true) with a statement then the code written between that statement will execute and then the rest of the code will start executing.

The same thing is also done by the if-else condition. But the syntax of the switch condition is easier to read and understandable for the programmers.

C Switch Statements Syntax.

switch (expression)
{
    case constant-expression1 :
    statements;
    break;                      /* The break function is optional  */
 
    case constant-expression1 :
    statements;
    break
 
    .
    .
    .
    .
     default:
     default statements;
}

Note: - The Break statement in the switch is not compulsory (optional) to add to the program. If the programmer wanted to execute the default statement then the break statement is not added to the program.

If none of the statements matched with the expression then by default statement is automatically displayed on the output screen.

Flow chart of the Switch Statement

Example of Switch Statement

Program to find whether a number is even, odd or negative.

#include<stdio.h>
int main()
{
  int number;
 
  printf("Enter a number: ");
  scanf("%d",&number);
 
  switch( number%2 )
  {
    case 0:
      printf("%d is even.", number);
      break;
    case 1:
      printf("%d is odd.", number);
      break;
    default:
        printf("Sorry...Number is Negative");
  }
 
  return 0;
}

Output:-




People Also Read : Nested IF-Else in C Programming

People Also Read : C Instruction With Example in C Language.

Continue Reading →

6/25/21

CSS Tutorials : CSS Margin Property

CSS Margin

 CSS Margin property is used to give space around Html elements. You can give some space to your Html elements using this CSS property. It is completely transparent you can’t see any background color when you give this property to elements.

You can also provide margins of Html elements independently such as left, right, bottom and top.   

You can provide the margin of an Html element by using values like - auto, %, length, etc. we can talk about it after some time with a full example. 

The Margin CSS Property basically have 5 property these are: - 

  1. Margin: - This CSS property will apply when the user wants to give margin value in one declaration
  2. Margin-left: - This CSS property will only apply on the left side of the Html element.
  3. Margin-top: - This CSS property is used to set the margin on the top side of the Html element.
  4. Margin-bottom: - This CSS property is used to set a margin on the bottom side of the Html element.
  5. Margin-right: - This CSS property will only apply on the right side of the Html element.

Now, the margin CSS Property also has a different value these values are: -

  1. Auto: - This margin value is set by the browser automatically
  2. Length: - This margin value is set by the user in px, cm, pt, etc
  3. %: - This margin value is set into %( percentages ) Like :- 25%, 30% etc
  4. Inherit: - This margin value is used to inherit margin from its parent element.

Let’s see through An amazing example of this topic.


<html>

<head>
    <title> CSS Margin Property </title>
    <style>
        .container{
            displayflex;
        }
       .box
        width216px;
        height209px;
        margin30px 30px 30px 30px;
       }
       #box1 {
            border3px solid red;
            background-colorrgb(204157157);
       }
       #box2{
            border3px solid green;
            background-colorrgb(157204182);
       }
       #box3{
            border3px solid blue;
            background-colorrgb(219230121);
       }
       #box4{
            border3px solid purple;
            background-colorrgb(163158233);
       }
    </style>
</head>

<body>
  <div class = "container">
      <p class=  "box" id="box1"> Box 1 </p>
      <p class = "box" id="box2"> Box 2 </p>
      <p class = "box" id="box3"> Box 3 </p>
      <p class = "box" id="box4"> Box 4 </p>
  </div>
</body>

</html>

Output :-


In the above example, we have seen the margin CSS property. We provide margin property to all the boxes in a single declaration. Now we are going to give different CSS property to all boxes.

But before the example let see an example in which we didn't give any margin in the Html document. Look at the image below in this image you will see that all the boxes are combined together. There is no space between them. 


Now, look at the example below. In this example, we applied different margin properties to the different boxes. 

Example: - 
<html>
<head>
    <title> CSS Margin Property </title>
    <style>
        *{
            margin0%;
            background-colorrgb(209190190);
        }
        .container{
            displayflex;
        }
       .box
        width216px;
        height209px;
        margin-left30px;
       }
       #box1 {
            border3px solid red;
            background-colorrgb(204157157);
       }
       #box2{
            border3px solid green;
            background-colorrgb(157204182);
            margin-right50px;
       }
       #box3{
            border3px solid blue;
            background-colorrgb(219230121);
            margin-top100px;
       }
       #box4{
            border3px solid purple;
            background-colorrgb(163158233);
       }
    </style>
</head>

<body>
  <div class = "container">
      <p class=  "box" id="box1"> Box 1 </p>
      <p class = "box" id="box2"> Box 2 </p>
      <p class = "box" id="box3"> Box 3 </p>
      <p class = "box" id="box4"> Box 4 </p>
  </div>
</body>
</html>

Output: -


People Also Read: - CSS Tutorial : CSS Border Radius Property

People Also Read: -  CSS Tutorials :- CSS Background Property

Continue Reading →

6/21/21

How to Make a Jpg image to pdf?

Converting an image into pdf is very easy but some people don’t know how to make a pdf of an image. So friend’s today tutorial based on it. I know a lot of people already know about it. If you know that great, but friend here, there are many other people who don’t know how to convert. In this tutorial, I am going to tell you many methods to convert an image into pdf. So Let’s Begin…

OFFLINE METHOD

In Window & laptop using MS Word

As we have written in our title you can make a pdf through MS Word. Here is the Step to make pdf through MS Word.

1. Open MS Word


2. Go to the Insert menu & Click on the picture option given on it.


3. Now Select the image which you want to convert into pdf. 


4. After it, press f12 key from your keyboard. 

5. Select the location where you want to save your pdf.

6. Now select the save as type as .pdf and then press Enter to Save.

Using PowerPoint

You can also convert an image to pdf using PowerPoint. You just need to follow the same procedure in PowerPoint as you followed in MS word.

ONLINE METHOD

If you have internet connectivity on your laptop or computer. Then you don’t need to follow the above steps. You just need to go to the website given below and just select the convert jpg to pdf option from the given options. And just drag the image on the window screen and press convert your image is successfully converted into pdf.  

Let’s see an example below.

Steps:- 

1. Open Google Chrome and go to the Search bar. 

2. Type “Image to pdf Converter” and press Enter.


3. Now you can see there is a lot of websites which is converting image to pdf. But my favorite is ilovepdf.com. Open the link in the new tab.




4. Now drag the image or open the image which you want to convert into pdf. 



5. Choose the pdf style (Portrait or landscape). And Also the Margin of the pdf. 



6. After it clicks on the Convert to pdf option


For me, the online method is the easiest method. You just need to drag the image and press the convert button and your pdf will ready to download. But when you stuck in a situation where you haven’t internet access in your laptop, pc, & mobile. You should go with the first method and make your pdf without the internet.


These are the two methods to making an image to pdf. We have discussed these two methods (Online & Offline). Hope you guys are understood well. 


Continue Reading →

Like us on facebook

blogger templatesblogger widgets

Follow on Twitter

Linkedin

Categories

Mad About Computer. Powered by Blogger.