div(id = "home")のテキストサイズを変更すると、divのサイズも変更されます。毎回divサイズが変わらずにテキストサイズを変更できるようにしたい。divのサイズを変更せずにHTML/CSSのフォントサイズを変更するにはどうすればよいですか?
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Josefin+Sans' rel='stylesheet' type='text/css'>
<link type="html/css" rel="stylesheet" href="websiteCSS.css"/>
<title>PROTOTYPE</title>
</head>
<body>
<div id="sidebar"></div>
<div id="home" class="header">Home</div>
</body>
</html>
とCSS:ここ
はHTMLですbody{
margin: 0;
background: #d5e9d7;
}
#sidebar {
z-index: 1;
position: fixed;
width: 20%;
height: 100%;
margin-top: 0;
margin-left: 0;
#background-color: light blue;
background-image: linear-gradient(to bottom, #545454 0%, #424242 100%);
margin-bottom: 10px;
}
.header {
position: fixed;
width: 2.5em;
height: 1em;
padding: 8px;
background-color: #b2b2b2;
margin-top: 0.5%;
margin-left: 20.5%;
font-family: 'Josefin Sans', sans-serif;
font-size: 2em;
color: #333333;
}
.header:hover {
font-size: 2.1em;
}
私は同様の問題に直面しています。そして、私は自分のdivの高さをあらかじめ決めておくことはできません。私はそれがフォントが既に大きかったなら、それがどんな高さに設定される必要がある。私はフォントサイズを増やすためにホバー効果を持っています。 – nikhilvj