Sort
Profile photo for Muhammad Saiful Islam

Are you really sure that your problem appears only in Google Chrome? Chrome and Apple Safari are using same engine (Webkit), so maybe you can check on the Safari browser to troubleshoot your problem.

If you don't have Safari (such as using Windows workstation, or using a Linux), I hope your HTML and CSS file are accessible from the Internet, so you can use BrowserShots (http://www.browsershots.org/) to check the display on various browsers.


First, try to apply
Quora User's answer. Set overflow: hidden.

If that doesn't work, unset the overflow: hidden. I think it's time to troubleshoot manually.

A

Are you really sure that your problem appears only in Google Chrome? Chrome and Apple Safari are using same engine (Webkit), so maybe you can check on the Safari browser to troubleshoot your problem.

If you don't have Safari (such as using Windows workstation, or using a Linux), I hope your HTML and CSS file are accessible from the Internet, so you can use BrowserShots (http://www.browsershots.org/) to check the display on various browsers.


First, try to apply
Quora User's answer. Set overflow: hidden.

If that doesn't work, unset the overflow: hidden. I think it's time to troubleshoot manually.

Almost all web designer know that Google Chrome has Developer tools. One of the tools is "Inspect Element", and it is enabled automatically. It's quite simple to use: right click on a <div> or any elements in your page and click Inspect Element.

Now, apologize me that I can't give you exact answer to this problem as I don't know the real code, except you've uploaded it somewhere. So, I will only explain the troubleshooting process that I usually do.

After right clicking on an element and clicking Inspect Element, you will see one of this two condition:

  1. A new dock appears in the bottom of your browser, like this:
  1. A new window appears, like this:


But they exactly have two same panes in the left and right. So it must not appears as a problem to you.

By default, the left pane will select the element that you selected before. The right pane will display all CSS attributes that have being applied to it. You can easily turn off some attributes.

Now, you can test to turning off some attributes that you think related to the problem, such as the float, overflow, anything. I hope this solves your problem, and this method useful for your future troubleshooting process. But I am sorry if this doesn't solves your problem.

Profile photo for Metis Chan

With today’s modern day tools there can be an overwhelming amount of tools to choose from to build your own website. It’s important to keep in mind these considerations when deciding on which is the right fit for you including ease of use, SEO controls, high performance hosting, flexible content management tools and scalability. Webflow allows you to build with the power of code — without writing any.

You can take control of HTML5, CSS3, and JavaScript in a completely visual canvas — and let Webflow translate your design into clean, semantic code that’s ready to publish to the web, or hand off

With today’s modern day tools there can be an overwhelming amount of tools to choose from to build your own website. It’s important to keep in mind these considerations when deciding on which is the right fit for you including ease of use, SEO controls, high performance hosting, flexible content management tools and scalability. Webflow allows you to build with the power of code — without writing any.

You can take control of HTML5, CSS3, and JavaScript in a completely visual canvas — and let Webflow translate your design into clean, semantic code that’s ready to publish to the web, or hand off to developers.

If you prefer more customization you can also expand the power of Webflow by adding custom code on the page, in the <head>, or before the </head> of any page.

Get started for free today!

Trusted by over 60,000+ freelancers and agencies, explore Webflow features including:

  • Designer: The power of CSS, HTML, and Javascript in a visual canvas.
  • CMS: Define your own content structure, and design with real data.
  • Interactions: Build websites interactions and animations visually.
  • SEO: Optimize your website with controls, hosting and flexible tools.
  • Hosting: Set up lightning-fast managed hosting in just a few clicks.
  • Grid: Build smart, responsive, CSS grid-powered layouts in Webflow visually.

Discover why our global customers love and use Webflow.com | Create a custom website.

Profile photo for Mark Simchock

Maybe I'm reading it the wrong way but...Silly question, have you cleared those floats? I'm not CSS wiz but if both cols are block then they can both float left or both float right. I don't think that's the problem. But then again, I'm not Mr. CSS either.

Profile photo for Abhijeet Kumar

There are several reasons why your content may be going outside of a div container in HTML/CSS:

  1. Overflow property: The overflow property in CSS controls how content that exceeds the boundaries of an element is handled. If the value is set to visible, the content will overflow outside of the container. Setting it to hidden or scroll will prevent the content from overflowing.
  2. Width and Height: If the width and height of the div container are not set correctly, the content may exceed the boundaries of the container. Make sure that the width and height are set to fit the content.
  3. Margins and Paddings

There are several reasons why your content may be going outside of a div container in HTML/CSS:

  1. Overflow property: The overflow property in CSS controls how content that exceeds the boundaries of an element is handled. If the value is set to visible, the content will overflow outside of the container. Setting it to hidden or scroll will prevent the content from overflowing.
  2. Width and Height: If the width and height of the div container are not set correctly, the content may exceed the boundaries of the container. Make sure that the width and height are set to fit the content.
  3. Margins and Paddings: The margins and paddings of the div container can also affect how the content is displayed. If the margins or paddings are set too large, the content may be pushed outside of the container.
  4. Float: If you are using floats, make sure that you clear the floats after the element you want to contain.
  5. Positioning: The positioning of the div container and its content can also affect how the content is displayed. Make sure that the position of the container and the content are set correctly.

It is always recommended to check the HTML and CSS code, inspect the element and use developer tools to debug the issue.

If you can provide the code or more information, I can help you to identify the problem.

Profile photo for Carib Glasco

You can set the height of the div to an absolute pixel value and this will restrict it to that height. A side effect of this is that at a certain point, your text or image etc. will start to overflow the div, which is usually not the preferred way of doing things.

To stop this from happening, you can set the div’s overflow to hidden.

  1. .testDiv { 
  2. border: 2px solid black; 
  3. width: 200px; 
  4. height: 200px; 
  5. overflow: hidden; 
  6. } 

Of course, you lose the ability to see the hidden content. So, unless that’s what you want to happen, you will want to set the overflow to auto, which will apply scroll bars if ne

You can set the height of the div to an absolute pixel value and this will restrict it to that height. A side effect of this is that at a certain point, your text or image etc. will start to overflow the div, which is usually not the preferred way of doing things.

To stop this from happening, you can set the div’s overflow to hidden.

  1. .testDiv { 
  2. border: 2px solid black; 
  3. width: 200px; 
  4. height: 200px; 
  5. overflow: hidden; 
  6. } 

Of course, you lose the ability to see the hidden content. So, unless that’s what you want to happen, you will want to set the overflow to auto, which will apply scroll bars if necessary.

Profile photo for Fiverr

The best freelance digital marketers can be found on Fiverr. Their talented freelancers can provide full web creation, or anything Shopify on your budget and deadline. If you’re looking for someone who can do Magento, Fiverr has the freelancers qualified to do so. If you want to do Dropshipping, PHP, or, GTmetrix, Fiverr can help with that too. Any digital marketing help you need Fiverr has freelancers qualified to take the reins. What are you waiting for? Start today.

Profile photo for Frank M. Taylor

Strictly speaking, you don't have vertical centering in CSS2.1 and there are techniques you can use to accomplish horizontal centering, but that doesn't really exist either.

Both horizontal and vertical centering exist in CSS3, however.

Why your code isn't working

  1. It appears that you are trying to use the "margin" technique, but margin: auto only centers horizontally.
  2. You are using two divs, which are block level elements (they naturally want to take up as much width as is available, and as much height as content needs). Block level elements also always start taking up space in the top. So it's pa

Strictly speaking, you don't have vertical centering in CSS2.1 and there are techniques you can use to accomplish horizontal centering, but that doesn't really exist either.

Both horizontal and vertical centering exist in CSS3, however.

Why your code isn't working

  1. It appears that you are trying to use the "margin" technique, but margin: auto only centers horizontally.
  2. You are using two divs, which are block level elements (they naturally want to take up as much width as is available, and as much height as content needs). Block level elements also always start taking up space in the top. So it's partly the display property
  3. In your case, even though the arrow has no height, it still wants to act "block level" and start its positioning at the top.

Alternatives

You're creating a CSS-based triangle, which requires you to have a height: 0 and width: 0. Setting a height/width will distort the triangle. So you need a solution that doesn't affect the properties of your triangle.

  1. Use a unicode character for the triangle, instead of HTML + CSS
    1. Treat the triangle like it's inline, and then set this on your #play-button text-align: center and line-height: 2
    2. completely ignore the CSS-based triangle
  2. Change the display property of your #play-button
    1. display: table-cell first, then add
    2. vertical-align: middle to center your play button
  3. Use padding on the #play-button for your centering:
    1. add padding: 10px;
    2. reduce the height and width by [math](padding * 2)[/math]: height: 15px; width: 15px;
  4. Use flex box, which allows vertical and horizontal centering:
    1. display: inline-flex;flex-direction: row; justify-content: center; align-content: center;

Fundamentally, the reason things aren't centering the way you want them to is because CSS 2 never allowed for vertical centering of block level elements. In order to accomplish your goal, you will have to change the display property and apply other properties that will "fake" your centering.

Profile photo for Matt Ginnity

By enabling developer options you can speed up your phone considerably .Go to settings then scroll down to about phone scroll down again until you see build number. Tap on build number 7-9 times and you will see a little pop-up that says you are now a developer. Tap back twice and you'll see a new Option called developer options tap that.

School down until you see the above photo. You can reduce same of the window animation, transition animation and the duration scales to .5x or even turn them off altogether, quite noticeably improving your device’s performance.

I hope this helps!

By enabling developer options you can speed up your phone considerably .Go to settings then scroll down to about phone scroll down again until you see build number. Tap on build number 7-9 times and you will see a little pop-up that says you are now a developer. Tap back twice and you'll see a new Option called developer options tap that.

School down until you see the above photo. You can reduce same of the window animation, transition animation and the duration scales to .5x or even turn them off altogether, quite noticeably improving your device’s performance.

I hope this helps!

Where do I start?

I’m a huge financial nerd, and have spent an embarrassing amount of time talking to people about their money habits.

Here are the biggest mistakes people are making and how to fix them:

Not having a separate high interest savings account

Having a separate account allows you to see the results of all your hard work and keep your money separate so you're less tempted to spend it.

Plus with rates above 5.00%, the interest you can earn compared to most banks really adds up.

Here is a list of the top savings accounts available today. Deposit $5 before moving on because this is one of th

Where do I start?

I’m a huge financial nerd, and have spent an embarrassing amount of time talking to people about their money habits.

Here are the biggest mistakes people are making and how to fix them:

Not having a separate high interest savings account

Having a separate account allows you to see the results of all your hard work and keep your money separate so you're less tempted to spend it.

Plus with rates above 5.00%, the interest you can earn compared to most banks really adds up.

Here is a list of the top savings accounts available today. Deposit $5 before moving on because this is one of the biggest mistakes and easiest ones to fix.

Overpaying on car insurance

You’ve heard it a million times before, but the average American family still overspends by $417/year on car insurance.

If you’ve been with the same insurer for years, chances are you are one of them.

Pull up Coverage.com, a free site that will compare prices for you, answer the questions on the page, and it will show you how much you could be saving.

That’s it. You’ll likely be saving a bunch of money. Here’s a link to give it a try.

Consistently being in debt

If you’ve got $10K+ in debt (credit cards…medical bills…anything really) you could use a debt relief program and potentially reduce by over 20%.

Here’s how to see if you qualify:

Head over to this Debt Relief comparison website here, then simply answer the questions to see if you qualify.

It’s as simple as that. You’ll likely end up paying less than you owed before and you could be debt free in as little as 2 years.

Missing out on free money to invest

It’s no secret that millionaires love investing, but for the rest of us, it can seem out of reach.

Times have changed. There are a number of investing platforms that will give you a bonus to open an account and get started. All you have to do is open the account and invest at least $25, and you could get up to $1000 in bonus.

Pretty sweet deal right? Here is a link to some of the best options.

Having bad credit

A low credit score can come back to bite you in so many ways in the future.

From that next rental application to getting approved for any type of loan or credit card, if you have a bad history with credit, the good news is you can fix it.

Head over to BankRate.com and answer a few questions to see if you qualify. It only takes a few minutes and could save you from a major upset down the line.

How to get started

Hope this helps! Here are the links to get started:

Have a separate savings account
Stop overpaying for car insurance
Finally get out of debt
Start investing with a free bonus
Fix your credit

Profile photo for Ray Butterworth

You don’t mention what you consider to be “issues”. Getting things to fit correctly is often a problem of what the web browser considers to be the size of a container. An excellent way of fixing many of these problems is to use this CSS style rule to make things behave the way one would expect them to: * { box-sizing: border-box; }

Or are you asking why things look different between two browsers? That’s often because of different default behaviour choices. One thing many people do is to use their style sheets to explicitly reset all the default values (e.g. set all margins, and padding to 0 by

You don’t mention what you consider to be “issues”. Getting things to fit correctly is often a problem of what the web browser considers to be the size of a container. An excellent way of fixing many of these problems is to use this CSS style rule to make things behave the way one would expect them to: * { box-sizing: border-box; }

Or are you asking why things look different between two browsers? That’s often because of different default behaviour choices. One thing many people do is to use their style sheets to explicitly reset all the default values (e.g. set all margins, and padding to 0 by default, and change them where needed). This is often accomplished by linking in a style sheet intended strictly for this purpose. Search Google for “css reset” for some examples.

Another common problem is caused by assigning fixed sizes to things. Instead of absolute units like “px”, “in”, etc., you can make your pages much more adaptable by using only relative units, in particular only “%” and “em”. Use the percentage when you are concerned with the overall layout, and “em” when you are concerned with size relative to the surrounding text. For instance make an image { width: 50%; min-width: 20em; } if you want it to take up half the width of the window but not get too small on tiny windows, and { width: 10em; max-width: 100%; } if you want the level of image detail to correspond to the visibility of the text. But never give sizes in absolute units.

Profile photo for CseMastery

You can use the CSS property white-space: nowrap; on the div to prevent it from breaking to the next line.

Here's an example of how you can prevent a div from breaking to the next line using CSS:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

.no-wrap {

white-space: nowrap;

}

</style>

<title>No Wrap Example</title>

</head>

<body>

<div class="no-wrap">

This div will not break to the next line even if the content is long.

</div>

</body>

</html>

In this example, the white-space: nowrap; CSS property is applied to the class

You can use the CSS property white-space: nowrap; on the div to prevent it from breaking to the next line.

Here's an example of how you can prevent a div from breaking to the next line using CSS:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

.no-wrap {

white-space: nowrap;

}

</style>

<title>No Wrap Example</title>

</head>

<body>

<div class="no-wrap">

This div will not break to the next line even if the content is long.

</div>

</body>

</html>

In this example, the white-space: nowrap; CSS property is applied to the class .no-wrap. Any content within a div with this class will not wrap to the next line, even if it exceeds the width of its container. Adjust the class and content as needed for your specific use case.

Profile photo for Johnny M

I once met a man who drove a modest Toyota Corolla, wore beat-up sneakers, and looked like he’d lived the same way for decades. But what really caught my attention was when he casually mentioned he was retired at 45 with more money than he could ever spend. I couldn’t help but ask, “How did you do it?”

He smiled and said, “The secret to saving money is knowing where to look for the waste—and car insurance is one of the easiest places to start.”

He then walked me through a few strategies that I’d never thought of before. Here’s what I learned:

1. Make insurance companies fight for your business

Mos

I once met a man who drove a modest Toyota Corolla, wore beat-up sneakers, and looked like he’d lived the same way for decades. But what really caught my attention was when he casually mentioned he was retired at 45 with more money than he could ever spend. I couldn’t help but ask, “How did you do it?”

He smiled and said, “The secret to saving money is knowing where to look for the waste—and car insurance is one of the easiest places to start.”

He then walked me through a few strategies that I’d never thought of before. Here’s what I learned:

1. Make insurance companies fight for your business

Most people just stick with the same insurer year after year, but that’s what the companies are counting on. This guy used tools like Coverage.com to compare rates every time his policy came up for renewal. It only took him a few minutes, and he said he’d saved hundreds each year by letting insurers compete for his business.

Click here to try Coverage.com and see how much you could save today.

2. Take advantage of safe driver programs

He mentioned that some companies reward good drivers with significant discounts. By signing up for a program that tracked his driving habits for just a month, he qualified for a lower rate. “It’s like a test where you already know the answers,” he joked.

You can find a list of insurance companies offering safe driver discounts here and start saving on your next policy.

3. Bundle your policies

He bundled his auto insurance with his home insurance and saved big. “Most companies will give you a discount if you combine your policies with them. It’s easy money,” he explained. If you haven’t bundled yet, ask your insurer what discounts they offer—or look for new ones that do.

4. Drop coverage you don’t need

He also emphasized reassessing coverage every year. If your car isn’t worth much anymore, it might be time to drop collision or comprehensive coverage. “You shouldn’t be paying more to insure the car than it’s worth,” he said.

5. Look for hidden fees or overpriced add-ons

One of his final tips was to avoid extras like roadside assistance, which can often be purchased elsewhere for less. “It’s those little fees you don’t think about that add up,” he warned.

The Secret? Stop Overpaying

The real “secret” isn’t about cutting corners—it’s about being proactive. Car insurance companies are counting on you to stay complacent, but with tools like Coverage.com and a little effort, you can make sure you’re only paying for what you need—and saving hundreds in the process.

If you’re ready to start saving, take a moment to:

Saving money on auto insurance doesn’t have to be complicated—you just have to know where to look. If you'd like to support my work, feel free to use the links in this post—they help me continue creating valuable content.

Profile photo for Prishabh Dwivedi

If you have found a bug in Google Chrome and want it to get fixed just report it to google. Go to the options of your browser and click Help. Report your issue, give attachments such as screenshots, e-mail or website links to help them to understand and recreate your issue. Go to Report an issue or send feedback on Chrome for more details.

You can fill the form for reporting security bug on any Google product here, Google - Security Bug Report

Through Chrome vulnerability reward program Google gives monetary awards and public recognition to the security researchers. For details about Chrome vuln

If you have found a bug in Google Chrome and want it to get fixed just report it to google. Go to the options of your browser and click Help. Report your issue, give attachments such as screenshots, e-mail or website links to help them to understand and recreate your issue. Go to Report an issue or send feedback on Chrome for more details.

You can fill the form for reporting security bug on any Google product here, Google - Security Bug Report

Through Chrome vulnerability reward program Google gives monetary awards and public recognition to the security researchers. For details about Chrome vulnerability reward program visit Application Security .

For what I can see and tell the arrow has no content and size. It will by default position itself to the zero points on the x and y axis of the parent div. This results in the image you get.

This is probably not the best way to solve this problem.

If the parent div is 35px by 35px and you want to center the object within the parent div, you have to offset it with at least 17.5px from the top and 17.5px from the left. But this will not result in the exact center from left to right. You have to take into account that the center of the arrow should be in the center so it is 17.5px plus the halve o

For what I can see and tell the arrow has no content and size. It will by default position itself to the zero points on the x and y axis of the parent div. This results in the image you get.

This is probably not the best way to solve this problem.

If the parent div is 35px by 35px and you want to center the object within the parent div, you have to offset it with at least 17.5px from the top and 17.5px from the left. But this will not result in the exact center from left to right. You have to take into account that the center of the arrow should be in the center so it is 17.5px plus the halve of the arrows width.

This can be achieved by using

  1. position: absolute; 
  2. left: /* sum of 17.5px and the halve of the arrow */px; 
  3. top: 17.5px  

I hope this helps!

Profile photo for Adam Klein

I’m not sure if I am reading the question correctly, but it depends on what you are trying to specifically accomplish. If you want a few places to start though, &nbsp; prevents breaks for an individual character space and <nobr></nobr> can be used to prevent breaks for a line of text. Otherwise, you can use nowrap as an in-line CSS treatment.

As a note, <nobr> is a little controversial, as it has been degraded in HTML. That said, I (personally) feel like it is still widely supported by most browsers.

Ex 1: This&nbsp;line&nbsp;of&nbsp;text&nbsp;won’t&nbsp;break
Ex 2: <nobr>This line of text won’t

I’m not sure if I am reading the question correctly, but it depends on what you are trying to specifically accomplish. If you want a few places to start though, &nbsp; prevents breaks for an individual character space and <nobr></nobr> can be used to prevent breaks for a line of text. Otherwise, you can use nowrap as an in-line CSS treatment.

As a note, <nobr> is a little controversial, as it has been degraded in HTML. That said, I (personally) feel like it is still widely supported by most browsers.

Ex 1: This&nbsp;line&nbsp;of&nbsp;text&nbsp;won’t&nbsp;break
Ex 2: <nobr>This line of text won’t break</nobr>
Ex 3: <span style=”white-space: nowrap;”>This line of text won’t break</span>

Profile photo for Quora User

It looks like the issue is caused by the blend of units. Your header-container is a width of 100% with a backround-color, which makes the color span the entire width of the screen (and 120px in height). You later specify a grid with 3 columns, where columb 1 is 200px, middle is 900 and end is 200px.

Now, what is the difference between 1300px and 100%? That's right; one is dynamically calculated while the other is a static value. On my phone screen (which is like 600 or 700 px wide) your last column flows over the color, because 1300px is a lot more than 700px. If you want your columns to always

It looks like the issue is caused by the blend of units. Your header-container is a width of 100% with a backround-color, which makes the color span the entire width of the screen (and 120px in height). You later specify a grid with 3 columns, where columb 1 is 200px, middle is 900 and end is 200px.

Now, what is the difference between 1300px and 100%? That's right; one is dynamically calculated while the other is a static value. On my phone screen (which is like 600 or 700 px wide) your last column flows over the color, because 1300px is a lot more than 700px. If you want your columns to always be inside your header of 100%, use dynamic units like % or fr. Fr is a unit “fraction” which you can think of like a percentage, but you are the one who controls what “100%” is. So if you say

grid-template-columns: 1fr 4fr 1fr

it will divide the available space into 6 pieces and give column 1 1/6 of that space, column 2 4/6 and column 3 1/6. You can also use percent, though. Hope that clarifies things

Profile photo for Abhishek Kumar

Hi,

you have used border in order to make that triangle play icon , so even if your div will be at center that border wont

so in this case you need to modify your css

please follow my code i just add some more style in order to make center

#services-offered #play-button {

background-color: lightgray;

height: 35px;

width: 35px;

border-radius: 20px;

position: relative;

/*Add Position relative here so that we can play with play icon div*/

}

.right-arrow {

height: auto;

width: auto;

border-left: 14px solid #000;

border-top: 7px solid transparent;

border-bottom: 7px solid t

Hi,

you have used border in order to make that triangle play icon , so even if your div will be at center that border wont

so in this case you need to modify your css

please follow my code i just add some more style in order to make center

#services-offered #play-button {

background-color: lightgray;

height: 35px;

width: 35px;

border-radius: 20px;

position: relative;

/*Add Position relative here so that we can play with play icon div*/

}

.right-arrow {

height: auto;

width: auto;

border-left: 14px solid #000;

border-top: 7px solid transparent;

border-bottom: 7px solid transparent;

margin: auto;

position: absolute;/*Change position here*/

left: 13px;/*adjusting icon though height and width of parent div are fixed*/

top: 10px;

}

Profile photo for Samiullah Khan

Caniuse.com tells us that chrome 57 supports the CSS Grid spec

You can also use CSS Atrule @supports to detect for browser support like

  1. @support(display: grid) { 
  2. main {  
  3. display: grid; 
  4. } 
  5. } 
  6.  
  7. @supports not (display: grid) { 
  8. main { 
  9. display: flex 
  10. } 
  11. } 

A working codepen demo is also attached.

Caniuse.com tells us that chrome 57 supports the CSS Grid spec

You can also use CSS Atrule @supports to detect for browser support like

  1. @support(display: grid) { 
  2. main {  
  3. display: grid; 
  4. } 
  5. } 
  6.  
  7. @supports not (display: grid) { 
  8. main { 
  9. display: flex 
  10. } 
  11. } 

A working codepen demo is also attached.

Profile photo for Beta ‘Ben’ Anggoro

I’ll assume that the question is actualy how to stack a div on another div. Float gives the idea of float: property which im sure thats not the question.

  • if its a parent-child situation, then simply give the parent position: relative & position: absolute for the child element. Then u can position this child to any absolute position to its parent, or if u want it to cover the parent, give it top: 0; left: 0; right: 0; bottom: 0;
  • If its not parent-child & they are siblings, - basically same idea- just wrap the 2 in a relative wrapper then give them absolute positioning, then apply the above rules.

I’ll assume that the question is actualy how to stack a div on another div. Float gives the idea of float: property which im sure thats not the question.

  • if its a parent-child situation, then simply give the parent position: relative & position: absolute for the child element. Then u can position this child to any absolute position to its parent, or if u want it to cover the parent, give it top: 0; left: 0; right: 0; bottom: 0;
  • If its not parent-child & they are siblings, - basically same idea- just wrap the 2 in a relative wrapper then give them absolute positioning, then apply the above rules.

Have fun!

Profile photo for Heidi Cool

I would add to my left margin, or in some cases I might add left padding. By adding space to the left you are pushing your content to the right.

Margins add space to the outside of an element, while padding adds space inside the element. If you add a left margin you move the whole div to the right.

.myclass {position: relative; margin: 0px 0px 0px 10px}

or

.myclass {position: relative; margin-left: 10px}

If you add padding on the left side you will shift the contents of your div to the right, though it would remain inside the div.

.myclass {position: relative; padding: 0px 0px 0px 10px}

or

  1. .myclass {p 

I would add to my left margin, or in some cases I might add left padding. By adding space to the left you are pushing your content to the right.

Margins add space to the outside of an element, while padding adds space inside the element. If you add a left margin you move the whole div to the right.

.myclass {position: relative; margin: 0px 0px 0px 10px}

or

.myclass {position: relative; margin-left: 10px}

If you add padding on the left side you will shift the contents of your div to the right, though it would remain inside the div.

.myclass {position: relative; padding: 0px 0px 0px 10px}

or

  1. .myclass {position: relative; padding-left: 10px} 

Margins and padding are included in the CSS Box Model, illustrated below. Read Introduction to the CSS box model to learn more.

Profile photo for Judah Frangipane

Globally add outlines to the elements on your page.

Add this CSS to your page:

  1. * { 
  2. outline: 1px dashed red; 
  3. } 

That will add a red, dashed outline around every element.

This shows the size of each element.

You can add an element outlines to any site:

  1. Open the website in Firefox (or another browser)
  2. Toggle the web developer tools (typically Command + Alt + I on Mac)
  1. Ensure the Inspector and Rules section is open
  1. Right click and select Add Rule
  1. Type in the following code choosing any color or style that suits you:

If you added the style correctly every element on the page should have an outline around it.

Onc

Globally add outlines to the elements on your page.

Add this CSS to your page:

  1. * { 
  2. outline: 1px dashed red; 
  3. } 

That will add a red, dashed outline around every element.

This shows the size of each element.

You can add an element outlines to any site:

  1. Open the website in Firefox (or another browser)
  2. Toggle the web developer tools (typically Command + Alt + I on Mac)
  1. Ensure the Inspector and Rules section is open
  1. Right click and select Add Rule
  1. Type in the following code choosing any color or style that suits you:

If you added the style correctly every element on the page should have an outline around it.

Once you spot the oversized div you can select it using the selection tool.

That’s the arrow in the corner.

Click that arrow and hover over the oversized element.

It will show you the name or id in the tooltip, plus the size, margin and padding and more with different colors.

While you are hovering over the element, the row that contains the code declaring the element will be highlighted.

You can use this info and the info on the right hand side in the Rules section to show the CSS styles declaration and cascading stylesheets that are applied to your element and showing from where.

Profile photo for Jack Mead

Self Proclaimed Engineer's Blog

If your looking for something like this… then here is what you should do.

Add the styling “overflow-x” (meaning left-right) to “auto”. If you want up and down scrolling, use “overflow-y: auto;”.

However, if you always want to see the scroll bar, set “overflow”, “overflow-x”, or “overflow-y” to “scroll”.

With the site above, it uses the root div to scroll against. There is no css parameters set on that, so as long as there is content that will overflow that div, it will default to “overflow: auto”. No need to specify.

Profile photo for Dave Chu

Sean's absolutely right. (oops, I made a pun!)

I will just add that if you want one DIV to deliberately "float over and cover" another DIV, you could make the child DIV a transparent background color, make it same size as the parent DIV or so, and/or use a certain amount of opacity on the child DIV so that you can see the content of both with the right blending.

Profile photo for Beta ‘Ben’ Anggoro

To my experience we shouldn’t be having too much problems with the mentioned these days.

On most cases when that happens, it is simply because i forgot to say

  1. * { 
  2. box-sizing: border-box; 
  3. } 

on my global css. Dont forget to add vendor prefixes if there’s no autoprefixer in action.

Try this and see how it goes. - as well as apologize for the wrong answer if you have done this.

Have fun!

Profile photo for Sindhuja Periyasamy

To fix unreadable CSS in Chrome when running HTML:

  1. Check for errors in your HTML and CSS.
  2. Clear the browser cache.
  3. Confirm correct file paths and CSS linking.
  4. Use Chrome's Developer Tools to debug.
  5. Disable browser extensions that may be causing issues.
  6. Ensure proper character encoding (UTF-8).
  7. Test in different browsers.
  8. Update Chrome if it's not up to date.
  9. Use a local web server instead of opening HTML directly from the file system.
Profile photo for Wesley Branton

What's not working with the fixed position div?I'd use viewport measurements instead of a percentage.

div {

position:fixed;

top:0px;

left:0px;

height:100vh;

width:100vw;

overflow:scroll;

}

You can use absolute for the position property instead of fixed if you want to have more content under the div.

Profile photo for Richard Cote

TL;DR: to move an element a bit to the right, your best bet is margin-right with a negative value or transform: translateX.

There’s many ways to move elements in CSS: left/right, margin-left/margin-right (positive or negative), padding, transforms with translateX, pseudo elements, or even transparent borders.

Margin-left/margin-right are probably the most common solution. Margin adds space to the outside of an element. Negative margins technically do this too, though in the opposite direction, and can extend well beyond the dimensions of the element. Counterintuitive, but very handy and perfectl

TL;DR: to move an element a bit to the right, your best bet is margin-right with a negative value or transform: translateX.

There’s many ways to move elements in CSS: left/right, margin-left/margin-right (positive or negative), padding, transforms with translateX, pseudo elements, or even transparent borders.

Margin-left/margin-right are probably the most common solution. Margin adds space to the outside of an element. Negative margins technically do this too, though in the opposite direction, and can extend well beyond the dimensions of the element. Counterintuitive, but very handy and perfectly legit in CSS.

TranslateX/translateY shifts an element. When using CSS transforms like translate, the element maintains its original position and size in the document flow. Super useful when tweaking without affecting the rest of the layout.

Padding can visually achieve what you are after. However, padding adds space to the inside of an element. With the default box model, this expands the size of the element in the document flow, which may break the layout. (Sorry, there is no negative padding.)

Left/right are a bit trickier to use. They position the element relative to its parent, so for moving a little to the left or right, it’s probably not the right solution, though bottom and top are good solutions for what’s in typesetting is called a baseline shift (e.g. adjusting <sup> tag positions). The positioning value (relative, absolute, fixed, etc.) of the element itself and its parent element may affect or conflict with the result.

Pseudo-elements add elements to the document flow that are not in the markup, before and/or after a particular element. A pseudo-element with a transparent background can create a controlled-width gap in the document flow, shifting the element in question.

Borders — when all else fails, it is possible to use a transparent border to nudge an element around. Set the border-width to the amount of offset you need and set the color to transparent. It’s best to specifically set all border sides (left/right/top/bottom) to clear any inherited values. Like margins, borders also add to the total width of an element.

It’s good to become familiar with the range of options above to avoid overriding inherited settings, effect a temporary state change (e.g. hover) without affecting the rest of the layout, or stay away from unnecessary !important declarations. Most of the above solutions can work at the same time on an element, though not all options are animatable.

N.B.: CSS flexbox or floats may override or conflict with your results, so be sure to check for them when troubleshooting.

Profile photo for Justin Tyler Reed

The question is paradoxical because adding the declaration {position: fixed;} to a div in your CSS makes the divs position relative to the viewport (the browser window). That means if the div is fixed, and it renders at the top of the page, content will flow under it as you scroll down. A good example of this is the navigation bar on this website. Content that flows under it is technically overlapping.

Any time you assign a value of fixed, absolute, or relative to the position property of a div, you are taking it out of the normal flow. The default value for element positions is static, meaning

The question is paradoxical because adding the declaration {position: fixed;} to a div in your CSS makes the divs position relative to the viewport (the browser window). That means if the div is fixed, and it renders at the top of the page, content will flow under it as you scroll down. A good example of this is the navigation bar on this website. Content that flows under it is technically overlapping.

Any time you assign a value of fixed, absolute, or relative to the position property of a div, you are taking it out of the normal flow. The default value for element positions is static, meaning they are in normal flow. Otherwise, out of the flow of the document, it’s depends on where you put the div, whether or not it overlaps with other elements.

Your problem with overlapping may be more specific. If by fixed, you mean that you want the div to be somewhere in the document and not overlap, I would try assigning a relative or absolute position. That allows you are able to play around with left, right, top, and bottom (you can do this with fixed as well).

Example:

div #bluebox {position: absolute; left: 400px; top: 10px;}

Profile photo for Aaron Adams

This makes me think that the webpage is either outdated, or is incorrectly recognizing your browser/device to be one that it is not.

If the webpage is outdated and poorly developed, it could be that the developer checks for specific browsers and devices that were up-to-date at the time, and block all others.

However, since it’s not very often that developers will do the above with their websites, it’s more likely that the site was simply designed for a different browser. Try viewing the site in another powerful browser like Firefox, and see what happens then. It could be that the site was design

This makes me think that the webpage is either outdated, or is incorrectly recognizing your browser/device to be one that it is not.

If the webpage is outdated and poorly developed, it could be that the developer checks for specific browsers and devices that were up-to-date at the time, and block all others.

However, since it’s not very often that developers will do the above with their websites, it’s more likely that the site was simply designed for a different browser. Try viewing the site in another powerful browser like Firefox, and see what happens then. It could be that the site was designed specifically for Firefox (or another browser), and will work incorrectly in anything other than Firefox (or another browser).

This is not an error message that comes with Google Chrome and is likely the webpage incorrectly identifying your device as outdated.

Profile photo for Heidi Cool

I can’t see the code in your image, so I’ll have to make a guess.

Try setting a max-height to your inside orange box as well as

  1. overflow: scroll; 

This would give you a vertical scroll bar. You could also use overflow:hidden if you want it to simply cut off the text without adding a scroll bar.

overflow

Profile photo for Sundeep Charan

Select that div in CSS and choose the height to be 100vh (viewport height). So that no matter the screen size is, It always will be 100% of the browser window

Profile photo for Phil Cheshire

Fixed position divs are notoriously difficult to do anything with. I would avoid them wherever possible and use a absolutely positioned element.

Sizing using vh and vw does help but only works in modern browsers.

Profile photo for Bulat Bochkariov

Set the right div to float: right; and make sure it comes first in your HTML. (Source order matters for floats, because they like it when you're sad.)

Live demo here: Left-right float layout.

You get the left div on the left for free, since that's where it would go by default, and the right div ends up on the right. Now we have two problems:

  1. The left div still takes up the whole page width; floats just paste the floated element on top of what's already there (on the z-axis).
  2. If the right div's height is greater than the wrapper's height, the wrapper won't expand to fit. The floated div just spills

Set the right div to float: right; and make sure it comes first in your HTML. (Source order matters for floats, because they like it when you're sad.)

Live demo here: Left-right float layout.

You get the left div on the left for free, since that's where it would go by default, and the right div ends up on the right. Now we have two problems:

  1. The left div still takes up the whole page width; floats just paste the floated element on top of what's already there (on the z-axis).
  2. If the right div's height is greater than the wrapper's height, the wrapper won't expand to fit. The floated div just spills all over everything.


Solutions:

  1. Figure out the right div's width, or give it one, and set the left div's margin-right to that plus any gap you want between them.
  2. Set the wrapper's overflow to auto.
Profile photo for Jérôme Cukier

There’s a number of ways to achieve that.

Here’s a few tactics:

https://codepen.io/jckr/pen/Loopmr

Profile photo for Vlad Nicula

I played with content editable a while back and wanted to create a editor like medium just for the fun of it, so I sort of had this question myself and had to do a bit of research and play around with content editable in the major browsers.

Each browser seems to treat new lines differently. There is no standard - at least there wasn't any 6 months ago when I last checked -

Some browsers add br tags, others create new paragraphs depending on what node you are in. I think there was a difference between the behaviour of pressing enter in a div versus pressing it in a paragraph.

The way to normalise

I played with content editable a while back and wanted to create a editor like medium just for the fun of it, so I sort of had this question myself and had to do a bit of research and play around with content editable in the major browsers.

Each browser seems to treat new lines differently. There is no standard - at least there wasn't any 6 months ago when I last checked -

Some browsers add br tags, others create new paragraphs depending on what node you are in. I think there was a difference between the behaviour of pressing enter in a div versus pressing it in a paragraph.

The way to normalise it - I'm assuming you want to do something like that since you asked this question - is to check each browser you want to support separately, see what tags they add or don't and write a bit of javascript in order to handle the normalisation so each browser behaves the same.

I wrote a small jQuery piece of code a while back while I was experimenting with this: Content Editable Test - JSFiddle

without using jQuery or any other JavaScript library, if a div with a vertical scrollbar is scrolled all the way to the bottom then you're pretty close using scrollTop == scrollHeight.

scrollTop refers to the top of the scroll position, which will be scrollHeight - offsetHeight

Read complete answer on how

About · Careers · Privacy · Terms · Contact · Languages · Your Ad Choices · Press ·
© Quora, Inc. 2025