Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line break for media-query only?

Is there any solution for line break when screen resolution is small instead of <br>? Because br break line all the time.

Here is my code:

<h2>I create unique, clean sites that are easy to navigate.<br>All my works comply with web</h2>

I think CSS3 may have solution of this issue.

Is there any solution for this <br>, because the line break only needed when page on mobile.

like image 615
Mo. Avatar asked Apr 30 '13 16:04

Mo.


People also ask

What is the breakpoint in the media query?

Essentially, media query breakpoints are pixel values that a developer/designer can define in CSS. When a responsive website reaches those pixel values, a transformation (such as the one detailed above) occurs so that the website offers an optimal user experience.

What does @media only screen mean?

only screen: The only keyword is used to prevent older browsers that do not support media queries with media features from applying the specified styles. Syntax: @media only screen and (max-width: width) Example 2.

How do I enable line breaks?

Press ALT+ENTER to insert the line break.


2 Answers

You could simply add a class to the BR tag and set it to be display:none by default.

Then in your mobile media query set it to "display: static"

I've suggested static rather than block because I don't think that a BR tag is display block by default so probably best to simply go with static.

like image 181
Billy Moat Avatar answered Sep 17 '22 14:09

Billy Moat


If using Bootstrap:

<br class="visible-xs">
like image 33
totallytotallyamazing Avatar answered Sep 17 '22 14:09

totallytotallyamazing