
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
How to create different device looks (smartphone, tablet and laptop) with CSS?
To create different device looks with CSS, the code is as follows −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .mobileDevice { position: relative; width: 360px; height: 400px; margin: auto; border: 16px rgb(7, 80, 35) solid; border-top-width: 60px; border-bottom-width: 60px; border-radius: 36px; } .mobileDevice:after { content: ''; display: block; width: 35px; height: 35px; position: absolute; left: 50%; bottom: -65px; transform: translate(-50%, -50%); background: #333; border-radius: 50%; border:2px solid rgb(200, 255, 0); } .mobileDevice .screen { width: 360px; height: 400px; background: white; } </style> </head> <body> <h1 style="text-align: center;">Device look example </h1> <div class="mobileDevice"> <div class="screen"> <iframe src="https://wikipedia.org/" style="width:100%;border:none;height:100%" /> </div> </div> </body> </html>
Output
The above code will produce the following output −
- Related Articles
- How to create a responsive website that will work on all devices, PC, laptop, tablet, and phone?
- How to create different shapes with CSS?
- How to create different dividers with CSS?
- How to detect device is Android phone or Android tablet?
- How to create tabs with CSS and JavaScript?
- How to create popups with CSS and JavaScript?
- How to Track Lost Smartphone with Google?
- How to use media queries for common device breakpoints with CSS?
- How to create tooltips with CSS?
- How to create "notes" with CSS?
- How to create arrows with CSS?
- How to create tab headers with CSS and JavaScript?
- How to create rounded and circular images with CSS?
- How to create "next" and "previous" buttons with CSS?
- How to create full-page tabs with CSS and JavaScript?

Advertisements