Wednesday, November 16, 2022

CSS Box property Web designing

 


CSS Box property 


CSS Box property



Box property

All Html element can be measured as boxes. In CSS the term "box model" is used when talking about design and layout. The CSS box model is basically a box that wraps around each HTML elements it consists of margins, borders, padding and action content. The image below illustration the box model


Details of the different parts

 

Margin :

The blank area around the border of an element is called margin. It is used to create an extra space around an element. The margin is transparent.


 Border :-

 A border that goes around the padding and content. One is a visual border in a document, sometimes a solid line, dotted or dashed line, or one made up of various objects, like flowers, baseballs, animals, or virtually any other object.  


Padding :-

 It is used to generate space around an element's content, inside of any defined borders. The padding is transparent, An element's padding is the space between its content and its border. The padding property is a shorthand property for padding-top. padding-right. padding-bottom.


Content :-

 The contents of box, where text and images appear. The content attribute gives the value associated with the http-equiv or name attribute.

box model allows us to attach a border around elements and to classify space between elements. 


CSS Box property

 Example 

<!DOCTYPE html>

 <html>

<head>

<style>

 div {

 background-color: lightblue:

width: 400px;

 border: 20px solid yellow;

 padding: 50px;

 margin: 50px;

 text-align: justify;

}

 </style>

</head> 

 <body>

 <h2> Welcome Toalaji Publication</h2> 17 <p> Here we see the demonstration of Box Model.</p>

<div>This text is written in the box or you can say that it is the text content of the box. The width of the box is 400px and the ineternal color is lightblue. We have added a 50px padding, 50px margin and a 20px yellow border.</div>

</body>

</html>


CSS Box property 

output 


CSS Box property

overflow: scroll

The overflow property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area.

overflow: scroll 

Example 

<!DOCTYPE html>

<html>

<head>

<style>

div.ex1 {

background-color: purple;

width: 200px;

height: 70px;

overflow: scroll;

border: 5px solid black;

}

</style>

</head>

<body>

<h2>overflow: scroll:</h2>

<div class="ex1">

It Indicates that the content is clipped but scroll-bar is added to see the rest of the content.It Indicates that the content is clipped but scroll-bar is added to see the rest of the content.</div>

</body>

</html>


overflow: scroll 

output 


overflow: scroll

overflow: hidden

The overflow property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area

overflow: hidden Example 

<!DOCTYPE html>

<html>

<head>

 <style>

div.ex2 {

background-color: yellow;

 width: 110px; 

height: 70px; 

overflow: hidden;

}

</style></head><body>

 <h2>overflow: hidden </h2> 

<div class="ex2">It Indicates that the content is clipped and that no scrolling mechanism should be provided to view the content outside the clipping region. </div>

</body>

</html>


overflow: hidden 

output 

overflow: hidden



overflow:auto

The auto value is similar to scroll , but it adds scrollbars only when necessary: You can use the overflow property when you want to have better control of the layout. The overflow property specifies what happens if content overflows an element's box.

overflow:auto 

Example 

<html>
<head>
<style>
div.ex3 {
background-color: lightblue; 
width: 110px;
 height: 70px; 
overflow: auto;
}
</style></head>
<body>
<h2>overflow:auto </h2> 

<div class="ex2">It Indicates that the content is clipped and that no scrolling mechanism should be provided to view the content outside the clipping region. </div>
</body>
</html>



overflow:auto 

output 

overflow:auto



Overflow: visible (default)

By default, the overflow is visible , meaning that it is not clipped and it renders outside the element's box: You can use the overflow property when you want to have better control of the layout. The overflow property specifies what happens if content overflows an element's box.
 

Overflow: visible 

Example 

</html>
<head>
<Style>
 div.ex4 {
background-color: lightblue;
 width: 110px;
height: 70px; 
overflow: visible;
 border: 5px dotted black;
}
 </style>
</head>
<body>
<h2>overflow: visible</h2>
<div class="ex4">It Indicates that the content is clipped and that no scrolling mechanism should be provided to view the content outside the clipping region. </div>

</body>

</html>

 

Overflow: visible 

 Output

Overflow: visible


html patterns attributes

table attributes tag html

html patterns attributes

Tuesday, November 15, 2022

Css inline block Web designing

    inline block


inline block/ output











1.display:inline-block

display:inline-block the top and bottom margins/paddings are respected, but wit display: inline they are not.

Compared to display: block, the major difference is that display: inline-block does not add a line 14 <mead> break after the element, so the element can sit next to other elements.

Display inline - block

 Example 

 <!DOCTYPE html>

 <html>

 <head> 

 <style>

 nav {

 background-color: lightblue; 

list-style-type: none;

  text-align: center;

 margin: 0; 

padding: 0; 

}

.nav li {

 display: inline-block;

 font-size: 30px; 

padding: 30px;

Margin:20px;

}

 </style>

</head>

 <body>

 <h1>display: inline-block</h1>

 <ul class="nav">

 <li><a href="#home">Home</a></li>

<li><a href="#about">Projects</a></li> 

 <li><a href="#clients">Clients</a></li> 

<li><a href="#contact">Contact</a></li>

 </ul>

</body>

 </html>

display:inline-block

 output

 

Inline block




2.Demonstration 

(inherit property value)


Demonstration

 Example 

<!DOCTYPE html>

<html>

<head>

<style>

body { display: inline; }

 p{ display: inherit;}

</style> </head>

<body>

<p>These two paragraphs generates inline boxes, and it results in</p> <p>no distance between the two elements.</p>

</body>

</html>


Demonstration 

output


Demonstration inherit property use



3.Flex-direction property 

The flex-direction property specifies the direction of the flexible items. If the element is not a flexible item, the flex-direction property.

Flex-direction property 

Example 


<html>
<head>
<style>

#main {
width: 300px; 
height: 200px;
border: 1px solid #c3c3c3;
display:-webkit-flex: / Safari "/ -webkit-flex-direction:row -reverse; /* Safari 6.1+ "/ display: flex: flex-direction: row-reverse;
#main div {
width: 50px;
height: 50px;
</style>
 </head>
 <body>
<h1>The flex-direction Property</h1>

<div id="main">
<div style="background-color:coral;">A</div>  
<div style="backgroundcolor:lightblue:">B</div>

<div style="background-color:khaki;">C</div>

<div style="background-color:pink;">D</div>

<div style="background-color:lightgrey;">E</div> <div style="background-color:lightgreen:;">F</div>

 </div>
</body>
</html>

Flex-direction property 

output 


Flex-direction property





VISIT THE LINK 

READ MORE 

css in combinators

type of css

list attributes tag

thought


Sunday, November 13, 2022

CSS Background propertie


 CSS Background propertie


CSS Background propertie

1. Properties

The CSS background properties are used to define the background effects for elements. To shorten the code, it is also possible to specify all the background properties in one single property. This is called a shorthand property.

Syntax:

 background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial | inherit;


1) Background  :-   Sets all the background properties in one declaration.

background-color,  background- image, background-repeat, background-attachment, background-position


2) background- attachment :- Sets whether a background image is fixed or scrolls with the rest of the page. 

scroll, fixed


3) background- color :- The background-color property specifies the background color of an element.

color-rgb, color-hex, color- name, transparent


4) background- image :- Sets the background image for an element.

url(URL)

5) background- position :- Sets the starting position of a background image.

top left, top center, top right, center left, center center, center bottom left, bottom center, bottom right, x% y%, xpos ypos

6) background- repeat :-    Sets how a background image will be repeated. 

repeat, repeat-x, repeat-y, no- repeat


2. Background-color Property

The background-color property sets the background color of an lement. The background of an element is the total size of the element, including padding and border Put not the margin). Use a background color and a text color that makes the text easy to read.

CSS Syntax:

 background-color: color / transparent | initial | inherit;

Property Values: 

Color

Specifies the background color. 


Transparent 

 This is the default value.Specifies that the background color should be transparent.

Initial 

Sets this property it's default value

Inherit  

Inherits this property from its parent element.


1. Background color 

Example 

<!DOCTYPE html>

<html>

<head>

<style>

body {

 background-color: rgb(180, 60, 50);}

h2 {

background-color:rgba(8, 150, 150, 10); } 

div { background-color:hsl (70, 45%, 45% ); } span{ background-color: yellow; }

</style> </head>

<body>

<h2>Welcome Pune Publication</h2> <div>Setting background color to "div"</div> <p>Setting <span> background color</span> to *p*</p>

</ul>

</body> 

</html>

Background color

 output

Background color


2.  Background color and image 

Example 

<!DOCTYPE html>

<html>

<head>

<style>

body {

  background-image: url("gradient_bg.png");

  background-repeat: repeat-x;

}

</style>

</head>

<body>

<h1>Hello World!</h1>

<p>Here, a background image is repeated only horizontally!</p>

</body>

</html>

 Background color and image

 output 


Background color and image

3. Linear gradient 

Using linear - gradient two colors as a background image for a <div> element. Internet 

Linear gradient 

Example 

<!DOCTYPE html>

 <html><head> <style>

 #bg1 { 

 height: 100px;

 background-color: #cccccc;

background-image: linear-gradient(red, yellow); }

#bg2 {

 height: 100px;

 background-color: #cccccc; 

background-image: linear-gradient(blue, red, green); 

}

 </style></head><body> 

 <h2>Linear Gradient</h2>

 <p>This linear gradient starts at the top. <br>It starts red, transitioning to yellow:</p>

 <div id="bg1"></div>

 <p>It starts blue, transitioning to red and red transforming to green:</p>

<div id="bg2"></div>

 </body>

 </html>

Linear gradient 

output 

Linear gradient

4. Linear Gradient as Background Image 

Example 

<!DOCTYPE html>

<html>

<head>

<Style>

#bg1 {

 height: 100px;

 background-color: #cccccc;  

background-image: repeating-linear-gradient(blue, green 10%, green 20%);

</style> 

</head>

<body>

<h2>Linear Gradient as Background Image</h2>

 <p>The repeating-linear-gradient() function is used to repeat linear gradients:</p> 

 <div id="bg1"></div>

 </body>

 </html>

Linear Gradient as Background Image

Output 

5. Radial gradient


Sets a radial gradient two colors as a background image for a <div> element use below code for two colors.


Radial gradient 

Example 

 <!DOCTYPE html> 

 <html>

<head>

 <style>

 #bg2 {

height: 200px; 

background-color: #cccccc; 

background-image: radial-gradient(red, yellow);

 </style> 

</head>

<body>

 <div id="bg2"></div>

<h2>Radial gradient</h2>

 </body> 

</html>

Radial gradient 

output 


Radial gradient


6. Repeating- linear- gradient

 Repeating linear gradient() function 

is used to repeat radial gradient.

Repeating- linear- gradient

 Example

<!DOCTYPE html>

 <html> 

<head> 

<style>

 #bg2 {

height: 200px;

background-color: #cccccc;

background-image: repeating-linear-gradient(yellow, red 10%, white 20%); 

</style> 

</head>

 <body> 

<h2> repeating linear gradient</2>

<div id="bg2"></div>

</body>

</html>

Repeating- linear- gradient 

output 

Repeating linear gradient



VISIT LINK

READ MORE 

Create Simple Feedback Form

background image with text

type of css