日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

css标签resolution,html/css to fit all screen resolution

發布時間:2023/12/20 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 css标签resolution,html/css to fit all screen resolution 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

可以將文章內容翻譯成中文,廣告屏蔽插件可能會導致該功能失效(如失效,請關閉廣告屏蔽插件后再試):

問題:

I'm working on the website and I'm trying to make it responsive to all resolutions but without success..

Here is HTML:

Lorem ipsum nasov je?

"Lorem ipsum dolor sit amet, consectetur adipisicing elit."

And here is css:

body

{

width:1920px;

background-color: #f8e0b3;

height:1080px;

}

div.container

{

width:100%;

height:100%;

}

div.header

{

background:url(img/header.jpg);

width:100%;

height:46%;

margin-top:;

margin-left:;

border-bottom: 2px solid black;

}

h1.naslov

{

font-size:60px;

color:white;

margin:0 auto;

margin-left:28%;

font-family: Aramis;

}

p.naslov-text

{

font-size:40px;

color:#634ea9;

margin:0 auto;

width:1000px;

margin-top:0%;

margin-left:36%;

font-family: Aramis;

}

When I resize my browser website doesn't resize. I've been trying all morning and I'm really burnout. Do anyone know what logic to approach to make this fit all screens , but only using css.

回答1:

As you are giving a fixed width to your body and p.naslov-text, your website will not resize. Remove all px sizing and replace them with percentage values.

But if you want fixed sizes and also responsive you must use css media queries like that:

body

{

width:1920px;

background-color: #f8e0b3;

height:1080px;

}

@media screen and (min-width: 500px) {

body {

width:420px;

}

}

@media screen and (min-width: 800px) {

body {

width:720px;

}

}

回答2:

CSS:

#gallery-1 img {

width:375px;

}

@media screen and (min-width: 1366px) {

#gallery-1 img {width:375px;}

}

@media screen and (min-width: 1440px) {

#gallery-1 img {width:428px;}

}

@media screen and (min-width: 1600px) {

#gallery-1 img {width:434px;}

}

@media screen and (min-width: 1920px) {

#gallery-1 img {width:540px;}

}

Reference: Stack Over Flow

JQUERY:

Use jquery for resize window. This one is dynamic code for window resizing for all browsers.

Example code here using jquery:

$(document).ready(function(){

$(window).resize();

});

$(window).resize(function{

// your code

var windowWidth=$(window).width();

var mainContainerWidth=windowWidth-100; // For example

$("#yourMainContainer").css({"width":mainContainerWidth+"px"});

});

like that you will try for your main class width and height.

回答3:

You have a fixed width on your body

回答4:

Remove width (in "px") from body and also from p.naslov-text. Try to give width:100%; to get responsive layout Fiddle

CSS:

body {

background-color: #f8e0b3;

height:1080px;

width:100%;

}

p.naslov-text {

font-size:40px;

color:#634ea9;

margin:0 auto;

margin-top:0%;

margin-left:36%;

font-family: Aramis;

}

回答5:

Hope this helps..

FIDDLE

CSS

body

{

width:100%;

background-color: #f8e0b3;

height:100%;

}

div.container

{

width:100%;

height:100%;

}

div.header

{

background:url(img/header.jpg);

width:100%;

height:100%;

margin: 2% 2% 2% 2%;

border-bottom: 2px solid black;

}

h1.naslov

{

font-size:60px;

color:white;

margin:0 auto;

float:none;

font-family: Aramis;

}

p.naslov-text

{

font-size:40px;

color:#634ea9;

margin:0 auto;

margin-top:0%;

float:left;

font-family: Aramis;

}

Also try to use media Query for whatever resolution you want..

回答6:

hello you should use @media screen in your css and you should use % instead px.

@media screen and (min-width: 1366px) {

#gallery-1 img {width:375px;}

}

@media screen and (min-width: 1440px) {

#gallery-1 img {width:428px;}

}

@media screen and (min-width: 1600px) {

#gallery-1 img {width:434px;}

}

@media screen and (min-width: 1920px) {

#gallery-1 img {width:540px;}

}

總結

以上是生活随笔為你收集整理的css标签resolution,html/css to fit all screen resolution的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。