I'm trying to make some big title responsive. I tried a few things such as: this Link. But it didn't work.
CSS
body {
margin-top: 50px; /* Required margin for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigationchanges. */
}
#page-wrap {
width: 760px;
margin: 0 auto;
}
.title {
font-family: Brush Script MT,cursive;
font-size: 10vw;
font-style: normal;
font-variant: normal;
font-weight: 500;
}
#welcome {
@extend .title;
}
#to {
@extend .title;
text-align: center;
font-size: 50px;
}
#mp{
@extend .title;
text-align: right;
}
.full {
background-image: url('../img/beach-bg1920-1080.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
/*******navbar elements *********/
.navbar-inner {
background:transparent;
border: solid#ffffff 2px;
}
.nav > li > a:focus, .nav > li > a:hover {
text-decoration: none;
background-color: $hover-color;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
color: white;
}
.navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand {
margin-left: -15px;
color: #ffffff;
}
.navbar-brand:focus, .navbar-brand:hover {
text-decoration: none;
}
/*******navbar elements End *********/
HTML
<div id="page-wrap">
<h1 id="welcome">Welcome!</h1>
<h2 id="to">to</h2>
<h1 id="mp">My Portfolio!</h1>
</div>
You can't see the word "My portfolio". i am trying to move everything to the left. in other words, I just want to make sure that this is going to look alright on mobile devices.
To make font size responsive in steps, set the base font size at each breakpoint. To create fluid text that smoothly changes size, use the calc() function to calculate a ratio between pixels and viewport widths, this will make the base font size grow at the correct rate relative to the screen width.
At a viewport width of 414px , 3.6vw will be 3.6% or about 15px . So the calculated font-size will be 21px + 15px , or about 36px . At a device width of 1440px , 3.6vw will end up being about 52px , so the font-size will be 21px + 52px or about 73px .
Optimal font sizes for desktop Body text - Font sizes should be around 16px to 18px for legibility (or 1.6rem to 1.8rem using our sizing rules mentioned above). If you can afford to go a bit larger, then even 21px can be pleasant to read.
In general, the rule of thumb is that font size needs to be 16 pixels for mobile websites. Anything smaller than that could compromise readability for visually impaired readers. Anything too much larger could also make reading more difficult.
Check this code.
#welcome{
font-size:10vw;
}
#to{
font-size:6vw;
}
#mp{
font-size:12vw;
}
<div id="page-wrap">
<h1 id="welcome">Welcome!</h1>
<h2 id="to">to</h2>
<h1 id="mp">My Portfolio!</h1>
</div>
We can make font size responsive by giving responsive unit to font. px unit is not responsive, whereas percent (%), vh/vw, em, rem units are responsive.
In given example link (css tricks) they've used viewport unit to make font responsive. viewport unit is nothing but vh,vw. vh is: viewport height and vw is viewport width.
If you give vw unit to font, it'll change/ get responsive according to your screen width.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With