Nitin Hepat

1588146758

Top 5 Ways To Display Two Div Side By Side Using CSS

In HTML, there are two types of element inline and block element.Inline elements can place element next to each other but they don’t support height and width property by default and block elements support width and height property by default but we can’t place block elements like two div side by side

So, here we can see How we can make it work

we will see how div can place next to each other in 5 different ways

  • display: inline-block (tradional way)
  • css flexbox method
  • css grid method
  • display: table method
  • float property

Using display: inline-block

display: inline-block property helps to place block element beside each other

But, we need to add extra width property to the block element because block element by default takes 100% width

eg.

<!DOCTYPE html>
<head>
</head>
<body>
  <div class="element">
  </div>
  <div class="element">
  </div>
</body>
</html>

// css

.element {
  display: inline-block;
  width: 100px;
  height: 100px;
  background: #ce8888;
  
}

and output will be

please check example here

Using flexbox

flexbox is a modern way of designing the layout of webpage and flexbox is not a single property its complete module it has a number of feature

let’s see how we can align divs next to each other using flexbox

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <div class="container">
    <div class="item">
    </div>
    <div class="item">
    </div>
  </div>
  </body>
</html>

// css file

.container {
  display: flex;
}
.item {
  background: #ce8888;
  flex-basis: 100px;
  height: 100px;
  margin: 5px;
}

//output

display: flex property given to container which makes child element in flex context and aligns divs next to each other

In the above example, You can see we have used flex-basis property which is used to give min-width for the item. 

please find demo here

Using css grid

CSS grid is another great approach to design web page and it’s complete module which comes with number of feature

Let’s see how we can display divs side by side using css grid

//html

<!DOCTYPE html>
<html>
  <head>
    <title>Grid Example</title>
    <style>
    </style>
  </head>
  <body>
    <div class="container">
      <div class="item">
      </div>
      <div class="item">
      </div>
    </div>
  </body>
</html>

//css file

 .container {
        display: grid;
        grid-template-columns: 100px 100px; 
        grid-template-rows: 100px;
        grid-column-gap: 5px;
      }
      
      .item {
      background: #ce8888;
 
       
      }

and output will be

property display: grid turns on the grid layout structure

In CSS file, grid-template-columns property helps to divide the page into number of columns, we have given 100px two times then it will create two columns

It’s very big module, I think you should check it out first in detail then only go for using it.

Find demo here

Using display table

display: table property is an alternative for <table> tag

let’s see how we can achieve dispaying div side by side using display: table property

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <div class="container">
    <div class="table-row">
     <div class="table-cell">
      
      </div>
      <div class="table-cell">
       
      </div>
    </div>
  </div>
  </body>
</html>

//css file

.container {
  display: table;
  width: 20%;
}
.table-row {
 
  display: table-row;
  height: 100px;
}
.table-cell {
  border: 1px solid;
  background: #ce8888;
  display: table-cell;
  padding: 2px;
}

and output will be

please find demo here

you can code above display: table example using html table tag also like below

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <table class="container">
    <tr class="table-row">
     <td class="table-cell">
      
      </td>
      <td class="table-cell">
       
      </td>
    </tr>
  </table>
  </body>
</html>

//css file

.container {
  display: table;
  width: 20%;
}
.table-row {
 
  display: table-row;
  height: 100px;
}
.table-cell {
  border: 1px solid;
  background: #ce8888;
  display: table-cell;
  padding: 2px;
}

and output will be

Using float property

The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow

let’s see how we can display div side by side using float

//html file

<!DOCTYPE html>
<head>
</head>
<body>
  <div class="element">
  </div>
  <div class="element">
  </div>
</body>
</html>

//css file

.element {
  float: left;
  width: 100px;
  height: 100px;
  background: #ce8888;
  margin: 5px
  
}

and output will be

 

Please find demo here

Conclusion:

There are number of ways to align divs next to each other but the question is which one is better

It’s totally depend upon requirement

flexbox and CSS grid are modern ways of doing layout for webpage and it’s a complete module and comes with a number of features.I recommend flexbox or CSS grid if need to layout the whole page

If you have minimal requirement then display: inline-block is perfect option.

#html #css #programming

What is GEEK

Buddha Community

Top 5 Ways To Display Two Div Side By Side Using CSS
anita maity

anita maity

1618667723

Sidebar Menu Using Only HTML and CSS | Side Navigation Bar

how to create a Sidebar Menu using HTML and CSS only. Previously I have shared a Responsive Navigation Menu Bar using HTML & CSS only, now it’s time to create a Side Navigation Menu Bar that slides from the left or right side.

Demo

#sidebar menu using html css #side navigation menu html css #css side navigation menu bar #,pure css sidebar menu #side menu bar html css #side menu bar using html css

Zachary Palmer

Zachary Palmer

1555901576

CSS Flexbox Tutorial | Build a Chat Application

Creating the conversation sidebar and main chat section

In this article we are going to focus on building a basic sidebar, and the main chat window inside our chat shell. See below.

Chat shell with a fixed width sidebar and expanded chat window

This is the second article in this series. You can check out the previous article for setting up the shell OR you can just check out the chat-shell branch from the following repository.

https://github.com/lyraddigital/flexbox-chat-app.git

Open up the chat.html file. You should have the following HTML.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Chat App</title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/chat.css" />
</head>
<body>
    <div id="chat-container">
    </div>
</body>
</html>

Now inside of the chat-container div add the following HTML.

<div id="side-bar">
</div>
<div id="chat-window">
</div>

Now let’s also add the following CSS under the #chat-container selector in the chat.css file.

#side-bar {
    background: #0048AA;
    border-radius: 10px 0 0 10px;
}
#chat-window {
    background: #999;
    border-radius: 0 10px 10px 0;
}

Now reload the page. You should see the following:-

So what happened? Where is our sidebar and where is our chat window? I expected to see a blue side bar and a grey chat window, but it’s no where to be found. Well it’s all good. This is because we have no content inside of either element, so it can be 0 pixels wide.

Sizing Flex Items

So now that we know that our items are 0 pixels wide, let’s attempt to size them. We’ll attempt to try this first using explicit widths.

Add the following width property to the #side-bar rule, then reload the page.

width: 275px;

Hmm. Same result. It’s still a blank shell. Oh wait I have to make sure the height is 100% too. So we better do that too. Once again add the following property to the #side-bar rule, then reload the page.

height: 100%;

So now we have our sidebar that has grown to be exactly 275 pixels wide, and is 100% high. So that’s it. We’re done right? Wrong. Let me ask you a question. How big is the chat window? Let’s test that by adding some text to it. Try this yourself just add some text. You should see something similar to this.

So as you can see the chat window is only as big as the text that’s inside of it, and it is not next to the side bar. And this makes sense because up until now the chat shell is not a flex container, and just a regular block level element.

So let’s make our chat shell a flex container. Set the following display property for the #chat-window selector. Then reload the page.

display: flex;

So as you can see by the above illustration, we can see it’s now next to the side bar, and not below it. But as you can see currently it’s only as wide as the text that’s inside of it.

But we want it to take up the remaining space of the chat shell. Well we know how to do this, as we did it in the previous article. Set the flex-grow property to 1 on the #chat-window selector. Basically copy and paste the property below and reload the page.

flex-grow: 1;

So now we have the chat window taking up the remaining space of the chat shell. Next, let’s remove the background property, and also remove all text inside the chat-window div if any still exists. You should now see the result below.

But are we done? Technically yes, but before we move on, let’s improve things a little bit.

Understanding the default alignment

If you remember, before we had defined our chat shell to be a flex container, we had to make sure we set the height of the side bar to be 100%. Otherwise it was 0 pixels high, and as a result nothing was displayed. With that said, try removing the height property from the #side-bar selector and see what happens when you reload the page. Yes that’s right, it still works. The height of the sidebar is still 100% high.

So what happened here? Why do we no longer have to worry about setting the height to 100%? Well this is one of the cool things Flexbox gives you for free. By default every flex item will stretch vertically to fill in the entire height of the flex container. We can in fact change this behaviour, and we will see how this is done in a future article.

Setting the size of the side bar properly

So another feature of Flexbox is being able to set the size of a flex item by using the flex-basis property. The flex-basis property allows you to specify an initial size of a flex item, before any growing or shrinking takes place. We’ll understand more about this in an upcoming article.

For now I just want you to understand one important thing. And that is using width to specify the size of the sidebar is not a good idea. Let’s see why.

Say that potentially, if the screen is mobile we want the side bar to now appear across the top of the chat shell, acting like a top bar instead. We can do this by changing the direction flex items can flex inside a flex container. For example, add the following CSS to the #chat-container selector. Then reload the page.

flex-direction: column;

So as you can see we are back to a blank shell. So firstly let’s understand what we actually did here. By setting the flex-direction property to column, we changed the direction of how the flex items flex. By default flex items will flex from left to right. However when we set flex-direction to column, it changes this behaviour forcing flex items to flex from top to bottom instead. On top of this, when the direction of flex changes, the sizing and alignment of flex items changes as well.

When flexing from left to right, we get a height of 100% for free as already mentioned, and then we made sure the side bar was set to be 275 pixels wide, by setting the width property.

However now that we a flexing from top to bottom, the width of the flex item by default would be 100% wide, and you would need to specify the height instead. So try this. Add the following property to the #side-bar selector to set the height of the side bar. Then reload the page.

height: 275px;

Now we are seeing the side bar again, as we gave it a fixed height too. But we still have that fixed width. That’s not what we wanted. We want the side bar (ie our new top bar) here to now be 100% wide. Comment out the width for a moment and reload the page again.

So now we were able to move our side bar so it appears on top instead, acting like a top bar. Which as previously mentioned might be suited for mobile device widths. But to do this we had to swap the value of width to be the value of height. Wouldn’t it be great if this size was preserved regardless of which direction our items are flexing.

Try this, remove all widths and height properties from the #side-bar selector and write the following instead. Then reload the page.

flex-basis: 275px;

As you can see we get the same result. Now remove the flex-direction property from the #chat-container selector. Then once again reload the page.

Once again we are back to our final output. But now we also have the flexibility to easily change the side bar to be a top bar if we need to, by just changing the direction items can flow. Regardless of the direction of flex, the size of our side bar / top bar is preserved.

Conclusion

Ok so once again we didn’t build much, but we did cover a lot of concepts about Flexbox around sizing. 

#css #programming #webdev 

Spring: A Static Web Site Generator Written By GitHub Issues

Spring

Spring is a blog engine written by GitHub Issues, or is a simple, static web site generator. No more server and database, you can setup it in free hosting with GitHub Pages as a repository, then post the blogs in the repository Issues.

You can add some labels in your repository Issues as the blog category, and create Issues for writing blog content through Markdown.

Spring has responsive templates, looking good on mobile, tablet, and desktop.Gracefully degrading in older browsers. Compatible with Internet Explorer 10+ and all modern browsers.

Get up and running in seconds.

中文介绍

Quick start guide

For the impatient, here's how to get a Spring blog site up and running.

First of all

  • Fork the Spring repository as yours.
  • Goto your repository settings page to rename Repository Name.
  • Hosted directly on GitHub Pages from your project repository, you can take it as User or organization site or Project site(create a gh-pages branch).
  • Also, you can set up a custom domain with Pages.

Secondly

  • Open the index.html file to edit the config variables with yours below.
$.extend(spring.config, {
  // my blog title
  title: 'Spring',
  // my blog description
  desc: "A blog engine written by github issues [Fork me on GitHub](https://github.com/zhaoda/spring)",
  // my github username
  owner: 'zhaoda',
  // creator's username
  creator: 'zhaoda',
  // the repository name on github for writting issues
  repo: 'spring',
  // custom page
  pages: [
  ]
})
  • Put your domain into the CNAME file if you have.
  • Commit your change and push it.

And then

  • Goto your repository settings page to turn on the Issues feature.
  • Browser this repository's issues page, like this https://github.com/your-username/your-repo-name/issues?state=open.
  • Click the New Issue button to just write some content as a new one blog.

Finally

  • Browser this repository's GitHub Pages url, like this http://your-username.github.io/your-repo-name, you will see your Spring blog, have a test.
  • And you're done!

Custom development

Installation

  • You will need a web server installed on your system, for example, Nginx, Apache etc.
  • Configure your spring project to your local web server directory.
  • Run and browser it, like http://localhost/spring/dev.html .
  • dev.html is used to develop, index.html is used to runtime.

Folder Structure

spring/
├── css/
|    ├── boot.less  #import other less files
|    ├── github.less  #github highlight style
|    ├── home.less  #home page style
|    ├── issuelist.less #issue list widget style
|    ├── issues.less #issues page style
|    ├── labels.less #labels page style
|    ├── main.less #commo style
|    ├── markdown.less #markdown format style
|    ├── menu.less #menu panel style
|    ├── normalize.less #normalize style
|    ├── pull2refresh.less #pull2refresh widget style
|    └── side.html  #side panel style
├── dist/
|    ├── main.min.css  #css for runtime
|    └── main.min.js  #js for runtime
├── img/  #some icon, startup images
├── js/
|    ├── lib/  #some js librarys need to use
|    ├── boot.js  #boot
|    ├── home.js  #home page
|    ├── issuelist.js #issue list widget
|    ├── issues.js #issues page
|    ├── labels.js #labels page
|    ├── menu.js #menu panel
|    ├── pull2refresh.less #pull2refresh widget
|    └── side.html  #side panel
├── css/
|    ├── boot.less  #import other less files
|    ├── github.less  #github highlight style
|    ├── home.less  #home page style
|    ├── issuelist.less #issue list widget style
|    ├── issues.less #issues page style
|    ├── labels.less #labels page style
|    ├── main.less #commo style
|    ├── markdown.less #markdown format style
|    ├── menu.less #menu panel style
|    ├── normalize.less #normalize style
|    ├── pull2refresh.less #pull2refresh widget style
|    └── side.html  #side panel style
├── dev.html #used to develop
├── favicon.ico #website icon
├── Gruntfile.js #Grunt task config
├── index.html #used to runtime
└── package.json  #nodejs install config

Customization

  • Browser http://localhost/spring/dev.html, enter the development mode.
  • Changes you want to modify the source code, like css, js etc.
  • Refresh dev.html view change.

Building

  • You will need Node.js installed on your system.
  • Installation package.
bash

$ npm install

*   Run grunt task.

    ```bash
$ grunt
  • Browser http://localhost/spring/index.html, enter the runtime mode.
  • If there is no problem, commit and push the code.
  • Don't forget to merge master branch into gh-pages branch if you have.
  • And you're done! Good luck!

Report a bug

Who used

If you are using, please tell me.

Download Details:
Author: zhaoda
Source Code: https://github.com/zhaoda/spring
License: MIT License

#spring #spring-framework #spring-boot #java 

Nitin Hepat

1588146758

Top 5 Ways To Display Two Div Side By Side Using CSS

In HTML, there are two types of element inline and block element.Inline elements can place element next to each other but they don’t support height and width property by default and block elements support width and height property by default but we can’t place block elements like two div side by side

So, here we can see How we can make it work

we will see how div can place next to each other in 5 different ways

  • display: inline-block (tradional way)
  • css flexbox method
  • css grid method
  • display: table method
  • float property

Using display: inline-block

display: inline-block property helps to place block element beside each other

But, we need to add extra width property to the block element because block element by default takes 100% width

eg.

<!DOCTYPE html>
<head>
</head>
<body>
  <div class="element">
  </div>
  <div class="element">
  </div>
</body>
</html>

// css

.element {
  display: inline-block;
  width: 100px;
  height: 100px;
  background: #ce8888;
  
}

and output will be

please check example here

Using flexbox

flexbox is a modern way of designing the layout of webpage and flexbox is not a single property its complete module it has a number of feature

let’s see how we can align divs next to each other using flexbox

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <div class="container">
    <div class="item">
    </div>
    <div class="item">
    </div>
  </div>
  </body>
</html>

// css file

.container {
  display: flex;
}
.item {
  background: #ce8888;
  flex-basis: 100px;
  height: 100px;
  margin: 5px;
}

//output

display: flex property given to container which makes child element in flex context and aligns divs next to each other

In the above example, You can see we have used flex-basis property which is used to give min-width for the item. 

please find demo here

Using css grid

CSS grid is another great approach to design web page and it’s complete module which comes with number of feature

Let’s see how we can display divs side by side using css grid

//html

<!DOCTYPE html>
<html>
  <head>
    <title>Grid Example</title>
    <style>
    </style>
  </head>
  <body>
    <div class="container">
      <div class="item">
      </div>
      <div class="item">
      </div>
    </div>
  </body>
</html>

//css file

 .container {
        display: grid;
        grid-template-columns: 100px 100px; 
        grid-template-rows: 100px;
        grid-column-gap: 5px;
      }
      
      .item {
      background: #ce8888;
 
       
      }

and output will be

property display: grid turns on the grid layout structure

In CSS file, grid-template-columns property helps to divide the page into number of columns, we have given 100px two times then it will create two columns

It’s very big module, I think you should check it out first in detail then only go for using it.

Find demo here

Using display table

display: table property is an alternative for <table> tag

let’s see how we can achieve dispaying div side by side using display: table property

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <div class="container">
    <div class="table-row">
     <div class="table-cell">
      
      </div>
      <div class="table-cell">
       
      </div>
    </div>
  </div>
  </body>
</html>

//css file

.container {
  display: table;
  width: 20%;
}
.table-row {
 
  display: table-row;
  height: 100px;
}
.table-cell {
  border: 1px solid;
  background: #ce8888;
  display: table-cell;
  padding: 2px;
}

and output will be

please find demo here

you can code above display: table example using html table tag also like below

//html file

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="index.css" />
</head>
<body>
  <table class="container">
    <tr class="table-row">
     <td class="table-cell">
      
      </td>
      <td class="table-cell">
       
      </td>
    </tr>
  </table>
  </body>
</html>

//css file

.container {
  display: table;
  width: 20%;
}
.table-row {
 
  display: table-row;
  height: 100px;
}
.table-cell {
  border: 1px solid;
  background: #ce8888;
  display: table-cell;
  padding: 2px;
}

and output will be

Using float property

The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow

let’s see how we can display div side by side using float

//html file

<!DOCTYPE html>
<head>
</head>
<body>
  <div class="element">
  </div>
  <div class="element">
  </div>
</body>
</html>

//css file

.element {
  float: left;
  width: 100px;
  height: 100px;
  background: #ce8888;
  margin: 5px
  
}

and output will be

 

Please find demo here

Conclusion:

There are number of ways to align divs next to each other but the question is which one is better

It’s totally depend upon requirement

flexbox and CSS grid are modern ways of doing layout for webpage and it’s a complete module and comes with a number of features.I recommend flexbox or CSS grid if need to layout the whole page

If you have minimal requirement then display: inline-block is perfect option.

#html #css #programming

Top 5 Mobile App Development Companies in New York

New York is the best potential business hub for the technology and IT industry. Thousands of companies are established in New York for the mobile app development or technology industry. So, here quite a confusion is that how to choose the right company for your business amongst all the companies. No need to worry about it, We have found the most reliable and trustworthy mobile app development companies that are the top-tiers in New York. Before we share the companies list you need to know the benefits of mobile app development for your business.

Key Benefits of Mobile App Development:

· Improves Efficiency

· Offers High Scalability

· Secures Your App Data

· Integrates With Existing Software

· Easy to Maintain

· Improves Customer Relationship

· Facilitates New Client Data Retrieval

· Provides Real-time Project Access

Are you looking for top mobile app development companies in New York that help to create a custom mobile app as per your business requirements? Please go through these Top 5 mobile app development companies that provide exceptional development and design services for your business.

Top Mobile App Development Companies in New York:

1. AppCluesInfotech

AppClues Infotech is one of the leading mobile app development company based in New York that builds high-quality mobile apps. Being a versatile mobile app development company, they provide services on various platforms like Android, iOS, Cross-platform, Windows, etc. They are aware of the latest technologies and features of industry. They utilize them to create a user-engaging mobile app. They have the best team of designers and developers who are delivered a mobile app with high-quality and performance.

Founded In: 2014

Employees: 50 to 200 Members

Location: USA

Website: https://www.appcluesinfotech.com/

2. Data EximIT

Data EximIT is one of the leading mobile app development company in New York that provides top-notch and elegant mobile app development services with the latest market trends and functionalities at a competitive price. They have highly experienced mobile app designers and developers team who have the best strength of developing all types of a mobile app. They deliver a feature-rich mobile app for their clients that give the best business ROI.

Founded In: 2004

Employees: 50 to 150 Members

Location: USA & India

Website: https://www.dataeximit.com/

3. WebClues Infotech

WebClues Infotech is the most reliable & superior company that builds custom mobile apps to do things differently. They are the best mobile app development company in New York, USA and as well as globally with high proficiency. They have a highly experienced app developers team that has the best strength of work on multiple platforms like android, Cross-platform, and iOS.

They have successfully delivered 950+ mobile app projects effectively and on-time. Build your Robust, Secure, Scalable & High-performance mobile app with WebClues Infotech with creative & dynamic designs at an affordable price.

Founded In: 2014

Employees: 50 to 250 Members

Location: USA, INDIA, UAE, UK & CANADA

Website: https://www.webcluesinfotech.com/

4. AppClues Studio

AppClues Studio is a leading mobile app development company in New York, USA. The company is versatile in developing custom mobile app development solutions to its customers across the globe. With an experience of 8+ years in mobile app development, Utility is hyper-focused on Return on Investment (ROI) and building good relationships with partner companies. The company is worked with a start-up to large enterprises.

Founded In: 2014

Employees: 50 to 150 Members

Location: USA & UK

Website: https://appcluesstudio.com/

5. WebClues Global

WebClues Global is a prominent mobile application development company in New York, USA. They are one of the top-tier mobile app developers who deliver high-end Android mobile app solutions to their clients. The company operated with 100+ qualified developers who working in different domains to give the best solution for their development. WebClues Global offers various services including web and mobile design & development, E-Commerce Development, Ui/Ux Development.

Founded In: 2014

Employees: 50 to 150 Members

Location: USA, INDIA, UAE, UK & CANADA

Website: https://www.webcluesglobal.com/

#top 5 mobile app development companies in new york #top 5 mobile app development companies in usa #top mobile app development companies in new york #top mobile app development companies in usa #top 5 mobile app development companies