react website development

2022.03.15

react website development

over the years,Web design has changed a lot。at the beginning,The main goal of web design is to create a smooth browsing experience for desktop users--After all, it's the only way people access the Internet。but since then,The mobile revolution has dramatically changed the way we design for the web。

(react website development)today,When a designer builds a new website,they need to make sure it looks great,function well,and convey the right message across a variety of browsers and devices。basically guaranteed,Website design clients will ask for a mobile version of their website。Responsive design principles make it possible。

(react website development)in this comprehensive guide,We'll cover everything you need to know about responsive web design--from the history surrounding it,to best practices,and powerful examples to learn from。

The Ultimate Guide to Responsive Web Design

(react website development)What is Responsive Web Design?

(react website development)The history of responsive web design

Adapt to different viewports

(react website development)Methods for Designing Responsive Websites

resize image

(react website development)The use of responsive typography

mobile-first design

Responsive website example

What is Responsive Website Design?

Responsive web design is a method of designing websites,It can render web pages on various screen sizes。This is an example of user interface plasticity--An interface can flow,and rendered in an ideal arrangement based on the available screen space。

but,Responsive design is more than a technical approach,It is the backbone of a good user experience。Instead of viewing screen size and resolution as design constraints,Think of your content as fluid,Give users complete control over how they want to look。

Responsive design needs to incorporate fluid grids、Flexible image and media queries。 smooth grid、Flexible images and media queries work together as a whole,They reformat web pages according to the user's preferences,and provide the best possible web experience。

smooth grid

A grid is a two-dimensional structure of intersecting lines,Lets you arrange content in columns and rows。in fluid grid,Each element in the grid is represented in a scale relative to its container,So its size depends on the size of the container it's in。This means that the exact number of columns in the grid can vary based on the user's viewport(The visible area on the user's device where the content can be seen)varies in size。E.g,You can display a three-column layout on the desktop,and display a single-column layout on mobile。

Relative unit

web elements,For example, the size of a content block or button is in relative units(as percentage)computational。Relative units make it possible to size elements based on the size of the viewport。

media inquiries

CSS(Cascading Style Sheets)Media queries can change the style of the page according to the characteristics of the viewport,such as the display resolution of the viewport and the actual size of the browser window。

The history of responsive design

last century80s,The proliferation of smartphones has prompted the web design community to think about how to do this without sacrificing usability or performance,Display content on different display sizes and resolutions。

web designerEthan Marcottein him2010year's article《Responsive Web Design》presented for the first time in "Responsive Design "the term。MarcotteInspired by Responsive Architectural Design,That is, a space will automatically adjust according to the number of people in it。As the name suggests,Responsive design responds to the width of the browser by adjusting layout elements to accommodate changes in available space。

(react website development)In addition to responsive design,A second, more tailored approach has also emerged:adaptive design。Adaptive Design was created a year ago by web designersAaron Gustafsonpresented in a book,designer for each breakpoint(usually320px、480px、760px、960px、1200pxand1600px)Create a layout。Designing Viewports to Fit Different Sizes,Using media queries to define properties for small and large screens will be changed。therefore,Each web page has multiple fixed layout versions for different screen sizes。

When we compare responsive and adaptive design,Responsive is often a more effective approach for advanced designers。because you don't need to create multiple versions of the layout,So less effort to implement and maintain the design。by responsive design,The content of the page is optimally arranged for each browser window。Responsive web design is also better for SEO,because it isGooglebotSave resources when crawling your site。OneGooglebotThe user agent only needs to crawl your page once,rather than crawl multiple times to retrieve multiple versions of your design。

(react website development)Adapt to different viewports

From giant TV screens to small smartwatches,There are multiple ways people can access the web today。In order to create a comfortable browsing experience for users,It is important to adapt to different viewports。

Responsive design solves this problem by allowing designers to target specific device classes and various screen sizes。To create a responsive design,Web designers need to do two things。

(react website development)1. in all theirHTMLadd on page "viewport "meta tags。

<meta name="viewport" content="width=device-width, initial-scale=1.0">


This tag provides the browser with instructions on how to render the page,Defines the dimensions and proportions of the web page。

2. Use media queries,Make its layout fit the requirements of a specific viewport。for example。

Increase the size of functional controls,as button,or increase the relative distance between them on mobile。This will help obey Fitz's law on touch devices,and create more comfortable user interaction。

Show or hide specific elements in the site layout。

Change the visual properties of certain elements on certain types of devices(as font color)。

(react website development)How to define media queries

(react website development)Below isCSSAn example of a media query in a file。

@media screen and (max-width: 480px) and (orientation: portrait) { .footer { float: none; width: auto; } }
thisCSSThe syntax of media queries may seem complicated at first,But as long as you are familiar with this structure,Decoding information becomes easy。exist@mediaafter and the first open{The part before the parentheses defines the condition。Let's review the conditions in our example。

media type。The media type is the one we want to applyCSSSet device type。We can define four classes of devices:Screen(desktop、Phones and Tablets)、Print(printer)、voice(Screen readers for reading pages aloud for visually impaired users)、all(for all media types)。If you do not specify this property,CSSAll properties will be applied by default。

media features。min-widthsets a minimum browser or screen width,some styles will work for this。If the width of the browser or screen is below this limit,These styles will be ignored。max-widthProperties do the exact opposite,Anything that exceeds the maximum browser or screen width will not apply to the corresponding media query。

(react website development)direction。Device orientation can be portrait(vertical direction)or landscape(horizontal direction)。This property is mainly applicable to mobile devices and tablets。

in brackets,when all conditions are met,A style condition can be applied。In our case,We want to check three conditions。

The type of device is desktop、Mobile or tablet?

Are our devices in portrait orientation??

Our device screen resolution(maximum width)is equal to or less than480px?

(react website development)if all conditions are met,This means that users are likely to be viewing our work on small-screen mobile devices in portrait mode。under these circumstances,The device will load the footer object'sCSSinstruction--otherwise,The directives in this section will be ignored。

How to construct media queries

There are two common structuringCSSstyle method,either put them in a file,Either use different files for different types of devices。Each method has its advantages and disadvantages。E.g,Search the media in other parts of the websiteCSSPosition together in oneCSSStyle sheet,You will minimize the number of systems needed to render webpages。 also,By distributing media queries in different files(Such as desktop.css, mobile.css),Will make developers easier to navigate in code,Because all styles related to mobile viewport are located in the same file。

Segmentation point

The resolution we defined in the above media query example can be used as a breakpoint。Breakpoint is the cornerstone of the response web design,Because they help designers define the category of the device,And adjust the design for each group。

"What breakpoints should I use my website??"This is a typical problem with web designers.。No universal breakpoint,Because all items are different,Different resolutions may be required。It can rely on the world's scope resolution statistics to define several common screen resolutions.。

360 x 640px(Small mobile device screen):10.10%。

1366 x 768px(Ordinary laptop screen):9.3%。

1920 x 1080px(Large desktop screen):8.35%。

(react website development)If you useEditor X,You will have3An default breakpoint begins to use。

Mobile device is350-750px

Tablet751-1000px

1001pxAnd larger desktop computer

But these breakpoints are not a constant。If you want to adjust,You can easily edit them or add custom breakpoints.,To adapt to your project needs,No need to sneak into code。

When choosing breakpoints for your project,Remember the following two basic rules。

Choose breakpoints based on the content you have。You should show the layout of the content should decide which breakpoints you want to use.。

Try to use the least breakpoint。please remember,You will need to adjust the content to match each breakpoint。Three or four breakpoints will make you have enough flexibility to frameize your content。

Method for designing response sites

(react website development)CSSMedia query is the basic tool for making a response website。All modern web browsers can be parsedCSSMedia query,So you will not encounter trouble when adjusting your design to accommodate a specific platform.。

In order to make your life easier,CreationCSSWhen the media query,You should not start from the beginning。You can use oneCSSframe,Such asBootstrap、BulmaorFoundation CSS。The advantage of this method is,Frame with a predefined breakpoint and visual style of basic object,Text、Button、Input bar, etc.。

(react website development)Another way to be used in response design isJavaScript。This method can be applied to not supportCSSMedia query device。Can useJavaScriptTo detect the size of the browser window,And load related style sheets。There is a code here,Can be used to calculate the current size of the window。

$(window).height(); $(window).width();

Whenever the user changes their browser window,BelowJQueryCode will be triggered,It will instantly load related styles。

<script type="text/javascript">
  $(document).ready(function(){
    $(window).bind("resize", resizeWindow);
    function resizeWindow(e){
      // this code will be triggered every time the user will change the browser window
      var newWindowWidth = $(window).width();

      if(newWindowWidth < 481){  
      // if the size of the windows is less than 481 it's likely that the person browse on mobile   
               $("link[rel=stylesheet]").attr({href : "mobile.css"});       
        }       
    }
  });
</script>
(react website development)CSSMedia query andJavaScriptNot a competitive method,They can work together very well。

Adjust the image size

(react website development)

react website development

Image is an important element of modern network。The quality of the image is largely influencing people's views--Not related images or pixelated assets are likely to cause a bad impression on your visitors.。Not only should be carefully selected related images(Those images that can communicate correct information to your audience),And to make sure the image can adapt to the size of any browser very well。

There are two types of images,Grating image(JPG、PNG、TIFF)Vector image(SVG)。The first group represents most images on the network,The key issue of this group of images is that they are not natural flow.。Unlike vector images to expand the size without loss of quality,The raster image must be modified for different resolutions.。

(react website development)Three methods for optimizing grating images for different resolution

Let us know more about image optimization,And get practical skills on how to adjust image size。you can useCSSAttributes to optimize your images for different resolutions。

1. Adjust the size of the image with image width properties。The width attribute defines the fixed width of the image.。BelowCSSRule will define the width500px。

The disadvantage of this method is,It uses fixed width to your picture,So it will display all devices on all devices.。This approach is not very easy to respond to the website.,Because improper size is easy to destroy the layout。

2. useCSSThe width property is set to100%To adjust the image size。

(react website development)img { width:100%; }

The key difference from the previous method is,You are not specified in your code exact width,But let the browser adjust the size of the picture as needed.。Havewidth: 100%;Attributes,The image will automatically zoom and narrow。The disadvantage of this method is,Image may occur when magnifying。

(react website development)3. useCSSMaximum width attribute reception。

img { height: auto; max-width: 100%; }

Maximum width attribute allows images to maintain their aspect ratio and ratio。When the maximum width is set to100%Time,The image will be suitable for all the width of its container。As long as there is no other width imageCSSStyle coverage this rule,Or view the area than the original width of the image.,This image will be loaded with its original size。This method is very useful for response web design。

Display size and visual assets

It is also important to consider how different types of equipment is rendered.。Although there is a possibility of using the same file on all types of devices,But the process of adjusting image size for small screen devices requires additional computing power,So use big files with raw resolutions that may result in performance degradation。

at the same time,High resolution display,Apple "Retinal film "Android "hDPI",May require you to provide visual assets with two to three times the normal resolution,To achieve a decent visual quality(@2x,and@3x)。In order to solve these two problems,It is recommended to use a special tool,Such asResponsive Breakpoints,It will allow you to prepare a separate image for each breakpoint。

If you useEditor XTo create a response website,You don't have to writeCSSCode to make your raster image correctly displayed in different viewports。This platform allows you to set up a precise width or height,Set a maximum wide or height percentage,And set a maximum width or high pixel。You can also set an image focus,This is when viewed in different formats,Vision will remain in the center position。

(react website development)Responsive use typesetting

People visit the website for obtaining content,And written text accounts for most of them。This means that the text is readable at any viewport size.,This is critical。therefore,When involving response typography,There are a few things to remember。

(react website development)

react website development

Don't put words in the graphics

Place the text in the graph,You will immediately reduce its response speed。Text cannot be enlarged without loss of quality,So you must recreate visual assets for each breakpoint。

Select font that can be scaled

Optimizing the typography of the response web page design starts from choosing the right font。

need to be able to do this,Web designers need to ensure that the size of the font is enough to make people feel。This is especially important for mobile devices.--Users should not need double-clicking or kneading zoom in order to read text。

Select font that can be clearly scaled,On the small screen of TV large screens and smart watches。Generally,Recommended network security font,Such asHelvetica,Because they are optimized,It looks good at different resolutions.。

Adjustment of text size

on the Internet,The size of the font can have two different ways。

Absolute value(Pixel、point

relative value(percentage,em/rem,View port width or heightvw/vh)

Let us start from the most popular options--Pixel。Pixel is absolute。The font size defined by pixels will be based on the user's screen.。When you use pixels,Modern browsers can make your design look similar in different resolutions。

Because most designers use pixels,This unit is very popular in the product team。However,Pixel cannot adjust the text according to your needs,And make your design are not so easy to get。

Another popular choice is calledemRelative value。When you useemTime,An elementemThe actual size is calculated relative to the font size of its parent element.。emThe relative value provides two important benefits。

Designer's benefits。The relative value allows the nested font size。EmInheriting its size from its parent elements,andremInherit from the root style。

Benefits for users。When you use a relative value,You gave the user a chance to change the default font size they like.,The website will automatically adjust to adapt to their needs。

If you useXEditor creates a website,You can use a text editor to zoom a text element。

(react website development)Now let's discuss the percentage。In the font size100%in the case of,The size of all elements in a page is limited to the default font relative to the browser.。

body { font: normal 100% Roboto, sans-serif; }

Finally, but not the least important thing is,Font "vw "When the unit is defined,Text size will follow the size of the browser window。

<h1 style="font-size:12vw">Hello World</h1>

Another thing to consider is,The font size of different equipment needs different。It should be large on the desktop,Small on the mobile device。same,The advantage of using the relative value is,Not only can you define an ideal dimensions for a particular element,You can also define the relationship between the size and other elements,Keep a good proportion in your layout。

BelowCSSWillh1Elements set a default font size,Desktop version is3.5 rem,Mobile version2 rem。

h1 { font-size: 3.5rem; } @media only screen and (max-width: 480px) { h1 { font-size: 2rem; } }

Although there is no precise font size rule,But it is recommended to apply the gold ratio to find the exact font size.。E.g,If the basic font of the desktop is16px,So titleh1The size will be multiplied by basic font size1.618Calculate(approximately26px)。

If you useEditor XCreate a website,You can use the text editor to set the minimum and maximum font size for a text element。

You can also set text between different breakpoints to zoom between different maximum and minimum sizes,To make your website typography fully respond。This will make sure your text can scalable smoothly when you adjust the screen.。

(react website development)Presidential and line spacing

In order to achieve good readability,You need to limit the length of the text line。A good empirical method is,Each line on the desktop50to60Character,Each line on mobile devices30to40Character。You can use the width attributes of the content container or useChof "Length value "To limit the number of characters per row。ChGlyph representative element font "0"(0,UnicodecharacterU+0030)Width。

p { overflow: hidden; max-width: 40ch; }

also,You should not squeeze the lines,Because the linear spacing will cause eye fatigue。Best practice is to use120%-140%Tower,Get good readability。Row(line-height)CSSAttributes are usually used to set the distance between the text lines。We can set this property with percentage,Make it corresponding to the font size of the element itself。

(react website development)p { line-height: 34%; }

Mobile priority design

In the past decade,The role of mobile devices play in our daily lives has changed huge changes.。In fact,56%Website traffic comes from smartphones。Optimization of mobile design is a key part of the web design process--Because a website that is not optimized for mobile devices is losing about half of the traffic。

Mobile priority design is a method,It suggested that the designer first created a good layout on the smallest breakpoint.,Then adjust the greater viewport。

There are three key differences between mobile and desktop design.。

Signature of the display。On the phone,You have fewer space to show your content,Need to carefully determine the priority of what you want to display。

interactive mode。Since users use their fingers and content interaction on mobile devices,Animation like hovering effects can't play a role。

usage scenario。People can interact with content on the road(E.g,When waiting for the train),Therefore, mobile websites should be designed for shorter user sessions and less attention.。

Follow the mobile priority user experience design method to provide several major benefits。

(react website development)Make the response design easier。It will help you determine the priority of content and functionality,And delete everything is not absolutely necessary。therefore,You will be possible to reduce the cognitive load of any other platform for users in the mobile side and your design.。

Conducive to search engine optimization。Google Assessment Website is mainly based on its mobile version。If a page needs to move users to make additional interaction,For example, zoom in to make it read,Then Google may not judge that it is mobile friendly。You can participate in Google's mobile friendly test,Check your website design。

(react website development)The following is a few aspects you need to think when you are performing a mobile design.。

Implement content priority strategy

Every page you designed,Consider what information you want to convey。Build a page around this information,And put the basic information over the fold。E.g,When you design one "contact us "When the page,Place the information on the top of the page,This user does not need to find it by scrolling.。

The process of creating a response website should always start from the planning layout。Organize your content and functional elements,Provide the visitor as possible experience。This doesn't mean you need to create a final result from the beginning.、Pixel perfect design。In fact,We recommend creating a schematic of a future design,To display the location of each block containing content and functional elements on the page。so,You can assess different layout changes along with your team and stakeholders.,And choose the most effective thing you think to your users。

Conditional loading

When determining the priority order,You may want to hide some content on your mobile device。CSSAttributesdisplay: none; Allow you to do this。You canCSSApply this property for specific elements that need hidden。E.g,You may have twoCSSstyle,desktop.cssDesktop,mobile.cssMobile device。

Desktop.css

#content { width: 100%; }

Mobile.css

#content { display: none; }

Notice,display:noneSometimesvisibility: hiddenConfuse。This is two differentCSSinstruction。Visibility:Hide only hides the content,So it gets no visible(Not drawn),Can't accept focus,Although it is still on the page。on the other hand,"show:without "Let's get rid of the content。

Designed for comfort interaction

Users interact with desktop website,But moving version is clicked and sliding through your fingers。People also use one of their mobile devices with one hand.,therefore,Optimize web layout,Make all key functional elements--Such as action call--All are located in the area of your thumb(Users should not stretch their thumb to an important element)It is very important。

(react website development)

react website development

The size of all tap water targets should be appropriate。The size of functional elements such as action calls should be at least9Millimeter,This is equivalent to the size of the user's thumb。If you put two interactive controls in parallel,You need to add enough blank between these interactive options。

Use a clear visual indicator

The touch screen does not show the capabilities of the hover effect,Because there is no cursor。UIThe clarity plays a more important role in mobile devices,It is important to design each element into a way that makes users maximize their functionality.。By using consistent visual style, this goal can be achieved.。E.g,You can use a specific blue to all interactive elements。

Optimize navigation for mobile

most of the time,Web designer relies on the Hamburger menu on the mobile side。However,A more favorable mode can be used,Such asprioity+Navigation mode。This mode ensures that the highest priority option is always visible to the user,while the rest of the options are hidden in "More "behind the link。

Keep in mind the hardware capabilities of your mobile device

(react website development)Slow load times are a common reason people abandon websites。Jakob NielsenThree response time limits are defined。0.1Seconds give the feeling of an instantaneous response。ideally,Your website should be in0.1react in seconds。1Keep the user's mind flowing in seconds。10Seconds are about the limit for maintaining user attention。But according to Google's research,When the page load time goes from1seconds to3Second,The probability of bounce will increase32%。


react website development

<img src="image.png" loading="lazy" alt="…" >

Always measure your website performance。Use Google's Speed Scorecard andDexecureand other tools to track your current performance,e.g. the time it takes to load your website on mobile。View Front-End Performance Checklist,Learn more about performance optimization。

if you useEditor Xbuild a website,Design elements in your layout's grid automatically cascade to fit different viewports,So when making changes on a larger breakpoint,will apply to each smaller breakpoint。

Minimize typing

Responsive web design is more than just making content fit,It is also to create a more comfortable way of interaction for your users。in the case of mobile devices,Typing is one of the most painful parts of the user journey。

Small screens make typing on mobile devices difficult and error-prone。whenever possible,Try to use pre-filled data in online forms。The advantage of mobile is,You can take advantage of some of its hardware capabilities。

Here are some tips on how to minimize typing on mobile devices。

useGEO-locationData is pre-populated with user city in shipping and billing information。you can use googlePlaces APIto provide accurate recommendations based on the user's location。

Use the device camera,Let users take pictures of their credit cards,and auto-fill credit card information。

useTouch ID/Face ID,instead of asking the user to enter their credentials。

(react website development)Use voice input in search forms。

(react website development)Test your designs on real devices and different browsers

(react website development)When you finish your website work,You should invest time to test it on a real device。Create a checklist of common tasks users should complete on your website,and invite people who represent your target audience to usability testing sessions。

In the process of testing,You can see your website on different platforms(android、iOS)work situation,and its cross-browser compatibility(Chrome、Safari、Firefox)。if you suspect somethingCSSWhether style directives are supported by a particular browser,you canCaniusecheck in。Testing will tell you where users face friction,and where your website needs to be optimized。

(react website development)Responsive website example

Explaining how responsive website design works is one thing,Seeing practice is another matter。Check out the responsive website design examples below,change your browser size,See how each design responds to changes。


react website development

Taupe and Honeyis a female creative studio for entrepreneurs,represents a simple and elegant example of responsive web design。The layout of the site can be flexibly adjusted to the width of the browser,and arrange content based on available screen space。when you browse the site on your desktop,You can see a split screen layout,Great pairing of visuals and text。

However,Once the browser window is narrowed,content will reflow,Make the layout more vertical,as it transforms into a single column,Optimized for easy scrolling。caution,The website shows a visible top-level menu on the desktop,But on mobile it hides it behind the hamburger icon。The font size has also changed,in order to create a comfortable reading experience on different types of devices。

Swank StudioScreenshots of websites put pictures first,and minimize text。Swank StudioScreenshots of websites put pictures first,and minimize text。

Swank Studio's image-driven website crops hero images on mobile,to show the subject's face,and minimize text。

Swank Studiois a luxury creative studio,is next on our list。This site follows a minimalist approach--it uses minimal text,and rely heavily on pictures to convey information。on the big screen,The white space around key information is spacious,Creates a positive impression on website visitors。

(react website development)react website development

when you switch to mobile,You will notice two things:image is cropped,to show a woman's face,The scale of the text will be adjusted as needed,becomes larger in proportion to the screen。This is done to maintain visual balance across each screen size,Make sure mobile users don't miss critical information。

Domaine Alepinscreenshot of website,The site uses a chevron layout on its homepage,Use a single-column layout on mobile。

Domaine AlepinUse a chevron layout on their homepage,Convert to single-column layout on mobile。This simplifies the browsing experience,while retaining the content。

existDomaine Alepinon the developer's website,We saw a similar approach。The site uses the "Of "Glyph layout。

When the width of the browser window is minimized,The design uses a new one-column layout。Nothing is removed at the smaller size,It's just rearranged for a better viewing experience。

Images play a key role in this website,therefore,Make sure each visual is scaled in size,It is vital that it is not unusable。You can also notice the change in font size,Keep it proportional to the size of the screen。

finally,The parallax effect available for both desktop and mobile users is a rather unusual design choice。usually,Parallax scrolling doesn't look pretty on mobile,butDomaine AlepinAbility to create beautiful parallax transitions on both platforms。

The more you invest in creating good content,The better chance your users will like your website。if you useEditor X,The process of creating a responsive website does not involve coding at all to define grids and breakpoints,So you can focus on what you want your audience to see--no matter which device they are on。

返回列表
更多新闻资讯

website development company american fork

2022-03-15

website development company american fork Florida, USA,What is the cost of a dynamic e-commerce website??At the data exitWe are e-commerce website designersThe company provides the best professional web design for small or large companies in

quality management plan for website development

2022-03-15

quality management plan for website development Website as a facade in the Internet promotion,Is the display of corporate image,The importance is self-evident。So how to build a high quality website?What issues need to pay attention to during websit

how to choose website development company

2022-03-15

how to choose website development company In today's fast-developing economy,Small and medium-sized enterprises have realized the importance of enterprise website to enterprise development。However,The website building market is polarized。Some