Table of Contents
Reply to discussion (solution)
Home Web Front-end HTML Tutorial Newcomer asked: The display effects of different sizes of monitors in HTML are different. How to solve the problem? _html/css_WEB-ITnose

Newcomer asked: The display effects of different sizes of monitors in HTML are different. How to solve the problem? _html/css_WEB-ITnose

Jun 24, 2016 am 11:51 AM

I just learned web design. When I was learning HTML, I made a page and put pet information on it. However, it looks normal on a 14.6-inch notebook, but distorted when viewed on a 19-inch monitor.
If it is corrected, it will look normal on a 19-inch monitor, but it will look awkward when you hold it on a laptop. Is there any function or label that can automatically change the size as the monitor changes?
The code is as follows:

<html>	<head>		<title>我的宠物</title>	</head>	<body bgcolor="#cyan">		<p>			<img src="image/1.png" width="400" height="200">		<!--这里放入一个banner-->		</p>		<br>		<h2><p>Jerry</p></h2>		<!--现在可以放入一张宠物的图像,使之右对齐-->		<p>			<img src="image/宠物猫.jpg" width="500" height="381" border="4" align="right"/>		</p>		<p>			年龄:1.2岁<br>			最喜爱的食物:鱼,热狗<br>			特点:好动,活泼,上房下梁<br>			<!--插入一条华丽的分割线-->			<hr align="left" width="800" size="3" color="red">			<p align=center>更新宠物日志:</p>			<!--再来一条华丽的分割线-->			<hr align="left" width="800" size="3" color="red">			2014年12月20号:<br>			  今天的天气很好,所以带jerry去鱼梁河钓鱼,一路上,看到美丽的田边开满了<br>			花儿,天边的云,映着彩霞的分红,好美一副景象。		</p>	</body></html>
Copy after login


The screenshot of the effect is as follows:


Reply to discussion (solution)

Sorry, the two pictures above are the effect of laptop. I put the wrong picture. The following is the effect of 19 monitor:

Try not to set w and h to fixed values. Instead, it is set as a percentage.

align="right"
The effect of this is that HTML and CSS are now separated. Your writing method is not good and is outdated. You should learn more about CSS.

Width and height should be proportional

Try to use % for width;
@media screen and (max-width: 480px){

}
@media screen and (max-width: 960px){

}
or define the style separately

align="right"
For this effect, html and css are now used Separate, your way of writing is not good and is outdated. You should learn more about CSS.

Okay. Learn more haha ​​css.

Try to use % for width;
@media screen and (max-width: 480px){

}
@media screen and (max-width: 960px) {

}
Or define the style separately

Well, I learned it.

The traditional method is to center the outermost fixed-width box and leave backgrounds on the left and right.
You can also use responsive layout, use percentages for simple layouts, and use CSS3 media queries to restyle the complex ones.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

See all articles