Responsive Layouts Flashcards
By default, are websites static or responsive?
By default, websites are usually responsive. It’s when you come into to CSS with set values, it create issues.
Why is it best to work with percentages?
Working with percentages makes the website automatically responsive. It makes creating responsive websites much easier.
how does the child interact with the parent element with percentages.
Whatever percentage is set for the parent, the child is the percent of the parent.
For example: You set the parent width as 80%. Then you set the child’s width at 50%. The child is the 50% of the parent’s width. It is NOT 50% of the viewport (window).
Why is it a good idea to avoid heights when creating a responsive website?
Using height causes more issues than they solve. Using height causes content to overflow and it’s get hidden. Turning off the height makes it become responsive. It adapts to whatever percentage that you’re working with.
If it’s not recommended to use height when working on a responsive site, what alternative that you can use?
If you need more background, use padding. Make sure to use responsive properties such as em or rem.
What are media queries and what is the basic syntax?
Media queries let us add new styles that target only specific conditions. Syntax is @media media-type and (media-features) { … }
What does this media query telling you?
@media (min-width: 400px) { body { background: purple; } }
this media query is saying that from a minimum width of 400px and bigger, turn the background color to purple
What are the media type that media queries let us target?
- Screen @media screen { … }
- Print @media print { … }
- Speech @media speech { … }
When should the media queries come after on the css stylesheet?
Media queries should always come after the DEFAULT selector that you already have.
What CSS property can you use to remove the white space on top of a header?
Padding
How do you center a menu in a navigation bar?
To center a menu (or list), you can use display: flex, justify-content: center;
What is another way that you can center text besides using flexbox?
margin: 0 auto;