gpt4 book ai didi

html - 增加不同部分标签的图像宽度?

转载 作者:行者123 更新时间:2023-11-28 00:08:44 25 4
gpt4 key购买 nike

我目前正在将网格用于个人元素。在桌面 View 中,我需要帮助调整图像宽度以适应所有页面宽度,而不是占一半。

我需要图像来自 this对此desired outcome但我自己想不出来。

这是问题的代码片段:

* {
box-sizing: border-box;
cursor: default;
}

html {
font-size: 16px;
}

html,
body {
min-height: 100vh;
margin: 0;

}

::selection {
background: #000;
color: #fff;
}

body {
-webkit-font-smoothing: antialiased;
font-family: Helvetica, sans-serif;
padding: 1.5rem 0 0 2rem;
background:#000;
font-weight: 400;
line-height: 1.4;
font-size: 1rem;
color: #777;
}

a {
text-decoration: underline;
color: #777;
}

a[href]:hover {
cursor: pointer;
color: #444;
}

h1,
.h1,
h4,
.h4 {
font-weight: 400;
margin-top: 0;
color: #000;
}

h1,
.h1 {
font-size: 1.5rem;
color: #fff;
}

h4,
.h4 {
font-size: 1rem;
margin: 0 0 .75rem;
color: #fff;
}

p {
margin: 0 0 2rem;
}

dd {
margin: 0;
}

ul {
padding: 0;
margin: 0;
}

li {
list-style-type: none;
margin: 0 0 .25rem;
}

.shell {
grid-template-columns: 44rem 15rem 15rem;
grid-column-gap: 4rem;
display: grid;
}

.widget {
margin: 0 0 2.5rem;
}

@media only screen and (max-width: 1024px) {
.shell {
grid-template-columns: 24rem;
grid-template-rows: auto;
grid-column-gap: 0;
grid-row-gap: 0;
}
}

@media only screen and (max-width: 450px) {
.shell {
grid-template-columns: 100%;
padding: 1.5rem 1.25rem 0;
font-size: 1.0625rem;
}
h4,
.h4 {
font-size: 1.25rem;
}
}


.responsive {
max-width: 100%;
height: auto;
}
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="A product designer and full-stack developer from the UK." name="description">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta property="og:description" content="Studying design and business at Griffith University in tropical Brisbane, Australia.">
<meta property="og:title" content="Noel Emmanuel">
<link href="./info_files/style.css" rel="stylesheet">
<title>NOEL EMMANUEL - INFO</title>
</head>

<body
class="shell">
<section>
<header>
<h1>Site header</h1></header>
<p class="h2">a design student in Brisbane, Australia.</p>

</section>
<section>
<dl class="widget"><dt class="h4">Things I can do</dt>
<dd>Visual Design, Art Direction, Branding, Websites, Event Design, Identity, Naming, Print, Writing, Design Strategy, Social Media & Typography.</dd>
</dl>


</section>
<section>
<div class="widget">
<h4>Contact</h4>
<ul>
<li><a href="mailto:email@gmail.com">Email</a></li>
<li><a href="https://instagram.com/kevin/">Insta</a></li>
</ul>
</div>
</section>

<section>
<img class="responsive" src="https://i.ytimg.com/vi/jCwIvz3ezcA/maxresdefault.jpg" alt="image 1" vspace="18">
<img class="responsive" src="https://i.ytimg.com/vi/jCwIvz3ezcA/maxresdefault.jpg" alt="image 2" vspace="18">
<img class="responsive" src="https://i.ytimg.com/vi/jCwIvz3ezcA/maxresdefault.jpg" alt="image 3" vspace="18">
</section>
</body>

</html>

这是关于 JSFiddle 的问题

最佳答案

为带有图像的部分添加新宽度不是一种选择吗?

//html
<section id="img-sec">

//css
#img-sec {
width: 82rem;
}

#my-img {
width: 40rem;
display: block;
margin-left: auto;
margin-right: auto;
}

关于html - 增加不同部分标签的图像宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55536565/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com